uzh-rpg / flightmare

An Open Flexible Quadrotor Simulator
https://uzh-rpg.github.io/flightmare/
Other
981 stars 342 forks source link

Could not build wheels for opencv-python with pip #209

Open Du0411 opened 1 month ago

Du0411 commented 1 month ago

ERROR: Command errored out with exit status 1: command: /home/du/miniconda3/envs/flightmare/bin/python /home/du/miniconda3/envs/flightmare/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmppkxinvhz cwd: /tmp/pip-install-xc3vig13/opencv-python_8b7e276b0e0e43f48b3f1aa50dffdc47 Complete output (2037 lines):


-- Trying 'Ninja' generator






-- 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.

Not searching for unused variables given on the command line.

-- The C compiler identification is GNU 11.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- The CXX compiler identification is GNU 11.4.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done (1.6s) -- Generating done (0.0s) -- Build files have been written to: /tmp/pip-install-xc3vig13/opencv-python_8b7e276b0e0e43f48b3f1aa50dffdc47/_cmake_test_compile/build







-- Trying 'Ninja' generator - success

Configuring Project Working directory: /tmp/pip-install-xc3vig13/opencv-python_8b7e276b0e0e43f48b3f1aa50dffdc47/_skbuild/linux-x86_64-3.6/cmake-build Command: /tmp/pip-build-env-f5zbhcwa/overlay/lib/python3.6/site-packages/cmake/data/bin/cmake /tmp/pip-install-xc3vig13/opencv-python_8b7e276b0e0e43f48b3f1aa50dffdc47/opencv -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-xc3vig13/opencv-python_8b7e276b0e0e43f48b3f1aa50dffdc47/_skbuild/linux-x86_64-3.6/cmake-install -DPYTHON_VERSION_STRING:STRING=3.6.13 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/tmp/pip-build-env-f5zbhcwa/overlay/lib/python3.6/site-packages/skbuild/resources/cmake -DPYTHON_EXECUTABLE:PATH=/home/du/miniconda3/envs/flightmare/bin/python -DPYTHON_INCLUDE_DIR:PATH=/home/du/miniconda3/envs/flightmare/include/python3.6m -DPYTHON_LIBRARY:PATH=/home/du/miniconda3/envs/flightmare/lib/libpython3.6m.so -DPython_EXECUTABLE:PATH=/home/du/miniconda3/envs/flightmare/bin/python -DPython_ROOT_DIR:PATH=/home/du/miniconda3/envs/flightmare -DPython_INCLUDE_DIR:PATH=/home/du/miniconda3/envs/flightmare/include/python3.6m -DPython_FIND_REGISTRY:STRING=NEVER -DPython_NumPy_INCLUDE_DIRS:PATH=/tmp/pip-build-env-f5zbhcwa/overlay/lib/python3.6/site-packages/numpy/core/include -DPython3_EXECUTABLE:PATH=/home/du/miniconda3/envs/flightmare/bin/python -DPython3_ROOT_DIR:PATH=/home/du/miniconda3/envs/flightmare -DPython3_INCLUDE_DIR:PATH=/home/du/miniconda3/envs/flightmare/include/python3.6m -DPython3_FIND_REGISTRY:STRING=NEVER -DPython3_NumPy_INCLUDE_DIRS:PATH=/tmp/pip-build-env-f5zbhcwa/overlay/lib/python3.6/site-packages/numpy/core/include -DPYTHON3_EXECUTABLE=/home/du/miniconda3/envs/flightmare/bin/python -DPYTHON_DEFAULT_EXECUTABLE=/home/du/miniconda3/envs/flightmare/bin/python -DPYTHON3_INCLUDE_DIR=/home/du/miniconda3/envs/flightmare/include/python3.6m -DPYTHON3_LIBRARY=/home/du/miniconda3/envs/flightmare/lib/libpython3.6m.so -DBUILD_opencv_python3=ON -DBUILD_opencv_python2=OFF -DBUILD_opencv_java=OFF -DOPENCV_PYTHON3_INSTALL_PATH=python -DINSTALL_CREATE_DISTRIB=ON -DBUILD_opencv_apps=OFF -DBUILD_opencv_freetype=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_DOCS=OFF -DPYTHON3_LIMITED_API=ON -DBUILD_OPENEXR=ON -DCMAKE_BUILD_TYPE:STRING=Release Exception: Not found: 'python/cv2/py.typed'

ERROR: Failed building wheel for opencv-python Successfully built flightgym Failed to build opencv-python ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

AnasAbdelR commented 1 month ago

So a couple of things, this is happening because the CMakelists.txt in flightmarelib grabs the latest but if you follow the instructions and use python 3.6 you will run into this issue

Next, the cleanest way that got me past this particular hurdle was the following:

sudo apt-get update
sudo apt-get install -y libopencv-dev
cd flightmare/flightlib
rm -rf build
mkdir build
cd build
export OpenCV_DIR=/usr/local/share/OpenCV
cmake ..
make