Issue
A Linux newbie here. On Linux Mint, python 3.8, under Anaconda, trying to install opencv-contrib-python by
pip install --no-binary opencv-contrib-python opencv-contrib-python
After a long and very resource-intensive process get this error. Any suggestions on what I am missing? As a side note, normal pip installation without --no-binary works fine, but results in a runtime error that I am trying to resolve per this post.
Configuring Project
Working directory:
/tmp/pip-install-cwq7rmvu/opencv-contrib-python/_skbuild/linux-x86_64-3.8/cmake-build
Command:
cmake /tmp/pip-install-cwq7rmvu/opencv-contrib-python/opencv -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-cwq7rmvu/opencv-contrib-python/_skbuild/linux-x86_64-3.8/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/home/artem/anaconda3/bin/python -DPYTHON_VERSION_STRING:STRING=3.8.5 -DPYTHON_INCLUDE_DIR:PATH=/home/artem/anaconda3/include/python3.8 -DPYTHON_LIBRARY:FILEPATH=/home/artem/anaconda3/lib/libpython3.8.so -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/skbuild/resources/cmake -DPYTHON3_EXECUTABLE=/home/artem/anaconda3/bin/python -DPYTHON3_INCLUDE_DIR=/home/artem/anaconda3/include/python3.8 -DPYTHON3_LIBRARY=/home/artem/anaconda3/lib/libpython3.8.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 -DOPENCV_EXTRA_MODULES_PATH=/tmp/pip-install-cwq7rmvu/opencv-contrib-python/opencv_contrib/modules -DCMAKE_BUILD_TYPE:STRING=Release
Copying files from CMake output
Traceback (most recent call last):
File "/home/artem/anaconda3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/home/artem/anaconda3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/artem/anaconda3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 221, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 207, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 258, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 496, in <module>
main()
File "setup.py", line 248, in main
skbuild.setup(
File "/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 625, in setup
_classify_installed_files(cmake_manifest, package_data, package_prefixes,
File "setup.py", line 381, in _classify_installed_files_override
with open('scripts/__init__.py', 'r') as custom_init:
FileNotFoundError: [Errno 2] No such file or directory: 'scripts/__init__.py'
----------------------------------------
ERROR: Failed building wheel for opencv-contrib-python
Failed to build opencv-contrib-python
ERROR: Could not build wheels for opencv-contrib-python which use PEP 517 and cannot be installed directly
Solution
Removing Anaconda and working with the python supplied with my Linux distro solved the issue.
Answered By - Artem Lebedev