Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake(?) error when running pip install pybgs on Windows #229

Open
monviso opened this issue Feb 21, 2024 · 2 comments
Open

Cmake(?) error when running pip install pybgs on Windows #229

monviso opened this issue Feb 21, 2024 · 2 comments

Comments

@monviso
Copy link

monviso commented Feb 21, 2024

I am getting unsuccessful installation running pip install pybgs on Windows in a conda environemt. this is the output I get. I am quite new to this, so thanks for any suggestion.

(SIFT3) C:\Users\Matteo>pip install opencv
ERROR: Could not find a version that satisfies the requirement opencv (from versions: none)
ERROR: No matching distribution found for opencv

(SIFT3) C:\Users\Matteo>pip install pybgs
Collecting pybgs
Using cached pybgs-3.3.0.post0.tar.gz (622 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pybgs
Building wheel for pybgs (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [97 lines of output]
running bdist_wheel
running build
running build_ext
cmake -HC:\Users\Matteo\AppData\Local\Temp\pip-install-aw41ui74\pybgs_75fb11b753b9499b8eeef5455fea6797 -Bbuild\temp.win-amd64-cpython-312\Release -DPYTHON_EXECUTABLE=D:\miniconda3\envs\SIFT3\python.exe -DBGS_CORE_STATIC=ON -DBGS_PYTHON_SUPPORT=ON -DBGS_PYTHON_ONLY=ON -DBGS_PYTHON_VERSION=3.12
-- Building for: Visual Studio 16 2019
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
  -- The C compiler identification is MSVC 19.29.30152.0
  -- The CXX compiler identification is MSVC 19.29.30152.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  --
  -- BGS_PYTHON_SUPPORT: ON
  -- BGS_PYTHON_ONLY:    ON
  -- BGS_CORE_STATIC:    ON
  -- PYTHON VERSION: 3.12
  -- OpenCV ARCH: x64
  -- OpenCV RUNTIME: vc16
  -- OpenCV STATIC: ON
  -- Found OpenCV: D:/miniconda3/envs/SIFT3/Library (found version "4.9.0")
  -- Found OpenCV 4.9.0 in D:/miniconda3/envs/SIFT3/Library/cmake/x64/vc16/lib
  -- You might need to add D:\miniconda3\envs\SIFT3\Library\cmake\x64\vc16\bin to your PATH to be able to run your applications.
  --
  -- OpenCV library status:
  --     version: 4.9.0
  --     libraries: opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_gapi;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_stitching;opencv_video;opencv_videoio;opencv_alphamat;opencv_aruco;opencv_bgsegm;opencv_ccalib;opencv_cvv;opencv_datasets;opencv_dnn_objdetect;opencv_dnn_superres;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_hdf;opencv_hfs;opencv_img_hash;opencv_intensity_transform;opencv_line_descriptor;opencv_mcc;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_quality;opencv_rapid;opencv_reg;opencv_rgbd;opencv_saliency;opencv_shape;opencv_stereo;opencv_structured_light;opencv_superres;opencv_surface_matching;opencv_text;opencv_tracking;opencv_videostab;opencv_wechat_qrcode;opencv_xfeatures2d;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto
  --     include path: D:/miniconda3/envs/SIFT3/Library/include

  CMake Deprecation Warning at modules/pybind11/CMakeLists.txt:8 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Deprecation Warning at modules/pybind11/tools/pybind11Tools.cmake:8 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.
  Call Stack (most recent call first):
    modules/pybind11/CMakeLists.txt:33 (include)


  CMake Warning (dev) at modules/pybind11/tools/FindPythonLibsNew.cmake:60 (find_package):
    Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
    are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
    the cmake_policy command to set the policy and suppress this warning.

  Call Stack (most recent call first):
    modules/pybind11/tools/pybind11Tools.cmake:16 (find_package)
    modules/pybind11/CMakeLists.txt:33 (include)
  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- Found PythonInterp: D:/miniconda3/envs/SIFT3/python.exe (found suitable version "3.12.2", minimum required is "3.12")
  -- Found PythonLibs: D:/miniconda3/envs/SIFT3/libs/Python312.lib
  -- pybind11 v2.3.dev1
  --
  -- Python library status:
  --     executable: D:/miniconda3/envs/SIFT3/python.exe
  --     library:
  --     include path: D:/miniconda3/envs/SIFT3/include
  CMake Warning (dev) at CMakeLists.txt:180 (exec_program):
    Policy CMP0153 is not set: The exec_program command should not be called.
    Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
    command to set the policy and suppress this warning.

    Use execute_process() instead.
  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- NUMPY_INCLUDE_DIR: D:\miniconda3\envs\SIFT3\Lib\site-packages\numpy\core\include

  -- Bulding bgslibrary_core STATIC
  -- Configuring done (5.5s)
  CMake Error at CMakeLists.txt:223 (add_library):
    No SOURCES given to target: bgslibrary_core


  CMake Generate step failed.  Build files cannot be regenerated correctly.
  error: command 'D:\\miniconda3\\envs\\SIFT3\\Scripts\\cmake.exe' failed with exit code 1
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pybgs
Running setup.py clean for pybgs
Failed to build pybgs
ERROR: Could not build wheels for pybgs, which is required to install pyproject.toml-based projects

@andrewssobral
Copy link
Owner

Hello @monviso ,

Compiling the bgslibrary on windows requires some preliminary steps, please see the links below:

You need a few requirements like:

You should install the OpenCV library (https://opencv.org/releases/) , then configure the env var OpenCV_DIR, see some info below:

Ps.: you may need to update some PATHs to match your environment)

git clone --recursive https://github.com/andrewssobral/bgslibrary.git
cd bgslibrary

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"

set OpenCV_DIR=C:\OpenCV\opencv-3.4.7\build
set BUILD_DIR=build_win_ocv347

set PATH=%PATH%;%OpenCV_DIR%\x64\vc15\bin
set PYTHONPATH=%PYTHONPATH%;%OpenCV_DIR%\python\cv2\python-3.7

if exist %BUILD_DIR% (
  echo Removing existing folder
  RMDIR /Q/S %BUILD_DIR%
)
mkdir %BUILD_DIR%
cd %BUILD_DIR%

cmake -DOpenCV_DIR=%OpenCV_DIR% -G "Visual Studio 16 2019" ..
:: If you want the Python Wrapper
:: cmake -DOpenCV_DIR=%OpenCV_DIR% -DBGS_PYTHON_SUPPORT=ON -DBGS_CORE_STATIC=ON -G "Visual Studio 16 2019" ..
:: The Python package will be generated at %BUILD_DIR%\pybgs.cp37-win_amd64.pyd
:: You also need to add it in your PYTHONPATH.

devenv bgslibrary.sln
cd ..

@andrewssobral
Copy link
Owner

@monviso

I just upgraded pybgs from pybgs-3.3.0.post0 to pybgs-3.3.0.post2 and the error seems to be fixed. Can you check please?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants