Open
Description
Expected behaviour
I tried to install opencv-python in my virtual environment and was expecting the opencv-python library v4.7.0.72 to be installed succesfully.
Even after multiple tries and trying different solutions/workarounds found online, nothing seems to help.
Actual behaviour
The build runs for +-3 hours, goes to 100% and then later on fails during installation phase of the project.
Following error is being returned:
FileNotFoundError: [Errno 2] No such file or directory: '_skbuild/linux-armv7l-3.9/cmake-install/python/cv2/config-3.py'
error: subprocess-exited-with-error
Steps to reproduce
- pip3 install --upgrade pip
result
(venv) username@raspberrypi:~/Desktop/myApp $ pip3 install --upgrade pip
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pip in ./venv/lib/python3.9/site-packages (23.0.1)
- pip3 install opencv-python --verbose
result
(venv) username@raspberrypi:~/Desktop/MyApp $ pip3 install opencv-py thon --verbose
Using pip 23.0.1 from /home/username/Desktop/MyApp/venv/lib/python3. 9/site-packages/pip (python 3.9)
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting opencv-python
Using cached opencv-python-4.7.0.72.tar.gz (91.1 MB)
Running command pip subprocess to install build dependencies
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple
Ignoring numpy: markers 'python_version == "3.6" and platform_machine != "aarc h64" and platform_machine != "arm64"' don't match your environment
Ignoring numpy: markers 'python_version == "3.7" and platform_machine != "aarc h64" and platform_machine != "arm64"' don't match your environment
Ignoring numpy: markers 'python_version == "3.8" and platform_machine != "aarc h64" and platform_machine != "arm64"' don't match your environment
Ignoring numpy: markers 'python_version <= "3.9" and sys_platform == "linux" a nd platform_machine == "aarch64"' don't match your environment
Ignoring numpy: markers 'python_version <= "3.9" and sys_platform == "darwin" and platform_machine == "arm64"' don't match your environment
Ignoring numpy: markers 'python_version == "3.10" and platform_system != "Darw in"' don't match your environment
Ignoring numpy: markers 'python_version == "3.10" and platform_system == "Darw in"' don't match your environment
Ignoring numpy: markers 'python_version >= "3.11"' don't match your environmen t
Collecting setuptools==59.2.0
Using cached https://www.piwheels.org/simple/setuptools/setuptools-59.2.0-py 3-none-any.whl (952 kB)
Collecting wheel==0.37.0
Using cached https://www.piwheels.org/simple/wheel/wheel-0.37.0-py2.py3-none -any.whl (35 kB)
Collecting cmake>=3.1
Using cached https://www.piwheels.org/simple/cmake/cmake-3.25.2-cp39-cp39-linux_armv7l.whl (17.3 MB)
Collecting pip
Using cached https://www.piwheels.org/simple/pip/pip-23.0.1-py3-none-any.whl (2.1 MB)
Collecting scikit-build>=0.13.2
Using cached https://www.piwheels.org/simple/scikit-build/scikit_build-0.16.7-py3-none-any.whl (79 kB)
Collecting numpy==1.19.3
Using cached https://www.piwheels.org/simple/numpy/numpy-1.19.3-cp39-cp39-linux_armv7l.whl (10.5 MB)
Collecting packaging
Using cached https://www.piwheels.org/simple/packaging/packaging-23.0-py3-none-any.whl (42 kB)
Collecting distro
Using cached https://www.piwheels.org/simple/distro/distro-1.8.0-py3-none-any.whl (20 kB)
Installing collected packages: cmake, wheel, setuptools, pip, packaging, numpy, distro, scikit-build
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
matplotlib 3.7.1 requires numpy>=1.20, but you have numpy 1.19.3 which is incompatible.
Successfully installed cmake-3.25.2 distro-1.8.0 numpy-1.19.3 packaging-23.0 pip-23.0.1 scikit-build-0.16.7 setuptools-59.2.0 wheel-0.37.0
Installing build dependencies ... done
Running command Getting requirements to build wheel
running egg_info
writing opencv_python.egg-info/PKG-INFO
writing dependency_links to opencv_python.egg-info/dependency_links.txt
writing requirements to opencv_python.egg-info/requires.txt
writing top-level names to opencv_python.egg-info/top_level.txt
reading manifest file 'opencv_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*' under directory 'opencv_contrib'
adding license file 'LICENSE-3RD-PARTY.txt'
adding license file 'LICENSE.txt'
writing manifest file 'opencv_python.egg-info/SOURCES.txt'
Getting requirements to build wheel ... done
Running command Preparing metadata (pyproject.toml)
running dist_info
creating /tmp/pip-modern-metadata-6qbzchkt/opencv_python.egg-info
writing /tmp/pip-modern-metadata-6qbzchkt/opencv_python.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-modern-metadata-6qbzchkt/opencv_python.egg-info/dependency_links.txt
writing requirements to /tmp/pip-modern-metadata-6qbzchkt/opencv_python.egg-info/requires.txt
writing top-level names to /tmp/pip-modern-metadata-6qbzchkt/opencv_python.egg-info/top_level.txt
writing manifest file '/tmp/pip-modern-metadata-6qbzchkt/opencv_python.egg-info/SOURCES.txt'
reading manifest file '/tmp/pip-modern-metadata-6qbzchkt/opencv_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*' under directory 'opencv_contrib'
adding license file 'LICENSE-3RD-PARTY.txt'
adding license file 'LICENSE.txt'
writing manifest file '/tmp/pip-modern-metadata-6qbzchkt/opencv_python.egg-info/SOURCES.txt'
creating '/tmp/pip-modern-metadata-6qbzchkt/opencv_python.dist-info'
adding license file "LICENSE-3RD-PARTY.txt" (matched pattern "LICEN[CS]E*")
adding license file "LICENSE.txt" (matched pattern "LICEN[CS]E*")
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.17.3 in ./venv/lib/python3.9/site-packages (from opencv-python) (1.24.2)
Building wheels for collected packages: opencv-python
Running command Building wheel for opencv-python (pyproject.toml)
patching file opencv/3rdparty/openexr/IlmImf/ImfSystemSpecific.cpp
--------------------------------------------------------------------------------
-- Trying 'Ninja' generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-6_x1lqim/opencv-python_5f225b8f191e4bdf9b9078bacd8de511/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying 'Ninja' generator - failure
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Trying 'Unix Makefiles' generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 10.2.1
-- 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 10.2.1
-- 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
-- Generating done
-- Build files have been written to: /tmp/pip-install-6_x1lqim/opencv-python_5f225b8f191e4bdf9b9078bacd8de511/_cmake_test_compile/build
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying 'Unix Makefiles' generator - success
--------------------------------------------------------------------------------
Configuring Project
Working directory:
/tmp/pip-install-6_x1lqim/opencv-python_5f225b8f191e4bdf9b9078bacd8de511/_skbuild/linux-armv7l-3.9/cmake-build
Command:
/tmp/pip-build-env-m8axndlg/overlay/lib/python3.9/site-packages/cmake/data/bin/cmake /tmp/pip-install-6_x1lqim/opencv-python_5f225b8f191e4bdf9b9078bacd8de511/opencv -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-6_x1lqim/opencv-python_5f225b8f191e4bdf9b9078bacd8de511/_skbuild/linux-armv7l-3.9/cmake-install -DPYTHON_VERSION_STRING:STRING=3.9.2 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/tmp/pip-build-env-m8axndlg/overlay/lib/python3.9/site-packages/skbuild/resources/cmake -DPYTHON_EXECUTABLE:PATH=/home/username/Desktop/MyApp/venv/bin/python -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.9 -DPYTHON_LIBRARY:PATH=/usr/lib/arm-linux-gnueabihf/libpython3.9.so -DPython_EXECUTABLE:PATH=/home/username/Desktop/MyApp/venv/bin/python -DPython_ROOT_DIR:PATH=/home/username/Desktop/MyApp/venv -DPython_INCLUDE_DIR:PATH=/usr/include/python3.9 -DPython_FIND_REGISTRY:STRING=NEVER -DPython3_EXECUTABLE:PATH=/home/username/Desktop/MyApp/venv/bin/python -DPython3_ROOT_DIR:PATH=/home/username/Desktop/MyApp/venv -DPython3_INCLUDE_DIR:PATH=/usr/include/python3.9 -DPython3_FIND_REGISTRY:STRING=NEVER -DPYTHON3_EXECUTABLE=/home/username/Desktop/MyApp/venv/bin/python -DPYTHON3_INCLUDE_DIR=/usr/include/python3.9 -DPYTHON3_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.9.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
-- The CXX compiler identification is GNU 10.2.1
-- The C compiler identification is GNU 10.2.1
-- 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
-- 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
-- ocv_init_download: OpenCV source tree is not fetched as git repository. 3rdparty resources will be downloaded from github.com by default.
-- Detected processor: armv7l
-- Found PythonInterp: /home/username/Desktop/MyApp/venv/bin/python (found suitable version "3.9.2", minimum required is "2.7")
CMake Warning at cmake/OpenCVDetectPython.cmake:81 (message):
CMake's 'find_host_package(PythonInterp 2.7)' found wrong Python version:
PYTHON_EXECUTABLE=/home/username/Desktop/MyApp/venv/bin/python
PYTHON_VERSION_STRING=3.9.2
Consider providing the 'PYTHON2_EXECUTABLE' variable via CMake command line
or environment variables
Call Stack (most recent call first):
cmake/OpenCVDetectPython.cmake:271 (find_python)
CMakeLists.txt:643 (include)
-- Could NOT find Python2 (missing: Python2_EXECUTABLE Interpreter)
Reason given by package:
Interpreter: Wrong major version for the interpreter "/bin/python"
-- Found PythonInterp: /home/username/Desktop/MyApp/venv/bin/python (found suitable version "3.9.2", minimum required is "3.2")
-- Found PythonLibs: /usr/lib/arm-linux-gnueabihf/libpython3.9.so (found suitable exact version "3.9.2")
Traceback (most recent call last):
File "/tmp/pip-build-env-m8axndlg/overlay/lib/python3.9/site-packages/numpy/core/__init__.py", line 22, in <module>
from . import multiarray
File "/tmp/pip-build-env-m8axndlg/overlay/lib/python3.9/site-packages/numpy/core/multiarray.py", line 12, in <module>
from . import overrides
File "/tmp/pip-build-env-m8axndlg/overlay/lib/python3.9/site-packages/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: libcblas.so.3: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-env-m8axndlg/overlay/lib/python3.9/site-packages/numpy/__init__.py", line 140, in <module>
from . import core
File "/tmp/pip-build-env-m8axndlg/overlay/lib/python3.9/site-packages/numpy/core/__init__.py", line 48, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.9 from "/home/username/Desktop/MyApp/venv/bin/python"
* The NumPy version is: "1.19.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: libcblas.so.3: cannot open shared object file: No such file or directory
-- Looking for ccache - not found
*** cut out ***
-- General configuration for OpenCV 4.7.0 =====================================
-- Version control: unknown
--
-- Platform:
-- Timestamp: 2023-03-07T08:35:01Z
-- Host: Linux 5.15.61-v7+ armv7l
-- CMake: 3.25.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/gmake
-- Configuration: Release
--
-- CPU/HW features:
-- Baseline:
-- requested: DETECT
--
-- C/C++:
-- Built as dynamic libs?: NO
-- C++ standard: 11
-- C++ Compiler: /usr/bin/c++ (ver 10.2.1)
-- C++ flags (Release): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-psabi -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-psabi -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-psabi -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-psabi -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
-- Linker flags (Debug): -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: /usr/lib/arm-linux-gnueabihf/libpng.so /usr/lib/arm-linux-gnueabihf/libz.so dl m pthread rt
-- 3rdparty dependencies: libprotobuf ade ittnotify libjpeg-turbo libwebp libtiff libopenjp2 IlmImf quirc
--
-- OpenCV modules:
-- To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo stitching video videoio
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: java python2 python3 ts
-- Applications: -
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI: NONE
-- GTK+: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.11)
-- JPEG: libjpeg-turbo (ver 2.1.3-62)
-- WEBP: build (ver encoder: 0x020f)
-- PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.6.37)
-- TIFF: build (ver 42 - 4.2.0)
-- JPEG 2000: build (ver 2.4.0)
-- OpenEXR: build (ver 2.3.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: NO
-- FFMPEG: NO
-- avcodec: NO
-- avformat: NO
-- avutil: NO
-- swscale: NO
-- avresample: NO
-- GStreamer: NO
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: pthreads
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Lapack: NO
-- Eigen: NO
-- Custom HAL: NO
-- Protobuf: build (3.19.1)
--
-- OpenCL: YES (no extra features)
-- Include path: /tmp/pip-install-6_x1lqim/opencv-python_5f225b8f191e4bdf9b9078bacd8de511/opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 3:
-- Interpreter: /home/username/Desktop/MyApp/venv/bin/python (ver 3.9.2)
-- Libraries: NO
-- numpy: NO (Python3 wrappers can not be generated)
-- install path: -
--
-- Python (for build): /home/username/Desktop/MyApp/venv/bin/python
--
-- Java:
-- ant: /bin/ant (ver 1.10.9)
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /tmp/pip-install-6_x1lqim/opencv-python_5f225b8f191e4bdf9b9078bacd8de511/_skbuild/linux-armv7l-3.9/cmake-install
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-install-6_x1lqim/opencv-python_5f225b8f191e4bdf9b9078bacd8de511/_skbuild/linux-armv7l-3.9/cmake-build
[ 0%] Built target opencv_dnn_plugins
--- Cut out between 1 & 99% since comment is too longer otherwise ---
[100%] Built target opencv_gapi
Install the project...
-- Install configuration: "Release"
****Cut out****
Copying files from CMake output
Traceback (most recent call last):
File "/home/username/Desktop/MyApp/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/username/Desktop/MyApp/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/username/Desktop/MyApp/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-n0_0bzbu/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 230, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "/tmp/pip-build-env-n0_0bzbu/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-n0_0bzbu/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 267, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-n0_0bzbu/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 512, in <module>
main()
File "setup.py", line 262, in main
skbuild.setup(
File "/tmp/pip-build-env-n0_0bzbu/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 673, in setup
_classify_installed_files(
File "setup.py", line 398, in _classify_installed_files_override
with open('%spython/cv2/config-%s.py'
FileNotFoundError: [Errno 2] No such file or directory: '_skbuild/linux-armv7l-3.9/cmake-install/python/cv2/config-3.py'
error: subprocess-exited-with-error
× Building wheel for opencv-python (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /home/username/Desktop/MyApp/venv/bin/python /home/username/Desktop/MyApp/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmpnv5v7b7u
cwd: /tmp/pip-install-ohiu737z/opencv-python_cc146731452e41c0bfc732e69dc17b71
Building wheel for opencv-python (pyproject.toml) ... error
ERROR: Failed building wheel for opencv-python
Failed to build opencv-python
ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects
System
- Raspberry Pi Model 3B+
- Ubuntu v18.04
- Linux 5.15.61-v7+
- Architecture: Arm
- Python v3.9
What I've tried so far
- Upgrading entire Linux system
- Reinstalling Python
- Reinstalling pip
- Upgrading pip
- Setting version explicitly to v4.7.0.72 ( using == operator )
- Setting version explicitly to v4.7.0.68