Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to build opencv-contrib-python (On Rasberry Pi)

I'm trying to install OpenCV on my Rasberry Pi but when I run the following command, I get some errors. Command:

pip install opencv-contrib-python

Results:

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting opencv-contrib-python
  Using cached opencv-contrib-python-4.5.1.48.tar.gz (148.8 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: numpy>=1.14.5 in ./.local/lib/python3.7/site-packages (from opencv-contrib-python) (1.19.5)
Building wheels for collected packages: opencv-contrib-python
  Building wheel for opencv-contrib-python (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3 /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp5g982u_t
       cwd: /tmp/pip-install-v1dx6hv5/opencv-contrib-python_85b21e0e2a604411afeb4dda9ea29270
  Complete output (12 lines):
  patching file opencv/3rdparty/openexr/IlmImf/ImfSystemSpecific.cpp
  /tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/cmake/data/bin/cmake: /usr/lib/arm-linux-gnueabihf/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/cmake/data/bin/cmake)
  /tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/cmake/data/bin/cmake: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.28' not found (required by /tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/cmake/data/bin/cmake)
    File "/tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
      cmkr = cmaker.CMaker(cmake_executable)
    File "/tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/skbuild/cmaker.py", line 95, in __init__
      self.cmake_version = get_cmake_version(self.cmake_executable)
    File "/tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/skbuild/cmaker.py", line 82, in get_cmake_version
      "Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
  Traceback (most recent call last):
  
  Problem with the CMake installation, aborting build. CMake executable is cmake
  ----------------------------------------
  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

I have already tried the following sources but nothing seems to help:

error-could-not-build-wheels-for-opencv-python-which-use-pep-517-and-cannot-be

Python OpenCV installation error

opencv-contrib-python

how-to-install-python-opencv-on-raspberry-pi

python3 --version Python 3.5.3

pip3 --version pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

like image 448
Cyebukayire Avatar asked Jan 11 '21 06:01

Cyebukayire


People also ask

Does OpenCV work on Raspberry Pi?

OpenCV makes adding computer vision to your Raspberry Pi projects a straight-forward process. Using it, you could train the Raspberry Pi to classify or recognise objects and react to them. In this guide, learn to install OpenCV on the Raspberry Pi 4 in a dozen steps.

Is OpenCV contrib necessary?

OpenCV contrib is a specialized module present in the Python programming language, which is exclusively needed for the system to run SURF feature descriptions alongside the OpenCV module present in the open-source library.


1 Answers

Try upgrading your set-up tool wheel

pip install --upgrade pip setuptools wheel

then install opencv again,

pip install opencv-contrib-python
like image 152
Michael Avatar answered Sep 24 '22 15:09

Michael