Open-cv installation error for python 3.6 in conda env

I am struggling to install opencv-python for GitHub - unibas-gravis/Occlusion-Robust-MoFA . After creating an environment using conda, I ran pip install -r requirements.txt and here is the terminal output:

  Copying files from CMake output
  creating directory _skbuild/linux-x86_64-3.6/cmake-install/cv2
  copying _skbuild/linux-x86_64-3.6/cmake-install/python/cv2/python-3/cv2.abi3.so -> _skbuild/linux-x86_64-3.6/cmake-install/cv2/cv2.abi3.so
  copying _skbuild/linux-x86_64-3.6/cmake-install/python/cv2/__init__.py -> _skbuild/linux-x86_64-3.6/cmake-install/cv2/__init__.py
  copying _skbuild/linux-x86_64-3.6/cmake-install/python/cv2/load_config_py2.py -> _skbuild/linux-x86_64-3.6/cmake-install/cv2/load_config_py2.py
  copying _skbuild/linux-x86_64-3.6/cmake-install/python/cv2/load_config_py3.py -> _skbuild/linux-x86_64-3.6/cmake-install/cv2/load_config_py3.py
  copying _skbuild/linux-x86_64-3.6/cmake-install/python/cv2/config.py -> _skbuild/linux-x86_64-3.6/cmake-install/cv2/config.py
  copying _skbuild/linux-x86_64-3.6/cmake-install/python/cv2/config-3.py -> _skbuild/linux-x86_64-3.6/cmake-install/cv2/config-3.py
  Traceback (most recent call last):
    File "/home/cash/anaconda3/envs/MOFA/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in <module>
      main()
    File "/home/cash/anaconda3/envs/MOFA/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/cash/anaconda3/envs/MOFA/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 249, in build_wheel
      metadata_directory)
    File "/tmp/pip-build-env-p0dpn5al/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 231, in build_wheel
      wheel_directory, config_settings)
    File "/tmp/pip-build-env-p0dpn5al/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-p0dpn5al/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 268, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/tmp/pip-build-env-p0dpn5al/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 158, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 532, in <module>
      main()
    File "setup.py", line 306, in main
      cmake_source_dir=cmake_source_dir,
    File "/tmp/pip-build-env-p0dpn5al/overlay/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 683, in setup
      cmake_install_dir,
    File "setup.py", line 445, in _classify_installed_files_override
      raise Exception("Not found: '%s'" % relpath_re)
  Exception: Not found: 'python/cv2/py.typed'
  ----------------------------------------
  ERROR: Failed building wheel for opencv-python
Failed to build opencv-python
ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

Can someone please assist me in resolving this issue :pray:

Here’s my system:

OS: Kubuntu 23.04 x86_64 
Kernel: 6.2.0-26-generic 
Shell: bash 5.2.15 
Terminal: konsole 
CPU: 12th Gen Intel i5-12400 (12) @ 5.600GHz 
GPU: Intel Alder Lake-S GT1 [UHD Graphics 730] 
GPU: NVIDIA GeForce GTX 750 Ti 
Memory: 7312MiB / 15718MiB 
1 Like

Getting same issue. Any resolution found for this?

same issue. Were any of you able to figure it out?

there is an official pypi opencv release

please use that instead of whatever conda tries …

Faced the same issue, this worked for me: pip install opencv-python==4.5.4.60

1 Like


the offical docs said the newest opencv is not support python 3.6.x ,check your opencv’s version

Your response was very helpful, thank you! :smile: