0

Based of this post, I have tried to install the below package at first step:

sudo apt-get update && sudo apt-get upgrade
sudo apt install cmake pkg-config build-essential git
sudo apt install libwebp-dev libjasper-dev libopenexr-dev libv4l-dev libavformat-dev  
sudo apt install libxvidcore-dev libx264-dev libdc1394-22-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libavcodec-dev 
sudo apt install libtiff-dev libpng-dev libjpeg-dev libswscale-dev
sudo apt install libhdf5-dev libhdf5-103
sudo apt install libgtk-3-dev libqtwebkit4 libqt4-test libqtgui4 python3-pyqt5
sudo apt install python3-dev python3-pip python3-testresources python3-numpy

but, I have get below error for installing the OpenCV by the pip install tqdm opencv-python imutils dlib imageiocommand (reference) :

pi@raspberrypi:~ $ pip install tqdm opencv-python imutils dlib imageio #-y
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting tqdm
  Using cached https://files.pythonhosted.org/packages/7a/ec/f8ff3ccfc4e59ce619a66a0bf29dc3b49c2e8c07de29d572e191c006eaa2/tqdm-4.61.2-py2.py3-none-any.whl
Collecting opencv-python
  Using cached https://files.pythonhosted.org/packages/a1/d6/8422797e35f8814b1d9842530566a949d9b5850a466321a6c1d5a99055ee/opencv-python-4.3.0.38.tar.gz
  Installing build dependencies ... done
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-C24u7o/opencv-python/setup.py", line 448, in <module>
        main()
      File "/tmp/pip-install-C24u7o/opencv-python/setup.py", line 99, in main
        % {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
      File "/usr/lib/python2.7/re.py", line 210, in escape
        s = list(pattern)
    TypeError: 'NoneType' object is not iterable
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-C24u7o/opencv-python/

enter image description here

So, if possible, I asked here to have some comment for fixing it.

Thanks.

2 Answers 2

3

I do not understand why do you use such an error prone procedure. Just install OpenCV from the default repository:

rpi ~$ sudo apt update
rpi ~$ sudo apt full-upgrade
rpi ~$ sudo apt install python3-opencv

This fit best to the Raspberry Pi OS and should install without problems. For additional moduls look with:

rpi ~$ apt list '*opencv*'
2
  • Thanks, @Ingo, dose using the sudo apt full-upgrade use high memory space on raspberry and if yes, almost how much space on the SD Card this commands needs? Jul 10, 2021 at 6:41
  • @sosa Using the shown commands is the recommended way to keep the Raspberry Pi OS up to date. If in doubt with storage space you can execute sudo apt clean at the end. This will just delete the downloaded and cached installation packages (not the installed programs). They will be downloaded again if needed.
    – Ingo
    Jul 10, 2021 at 7:41
1

You're using Pip for Python 2.7.

Use python3 -m pip install ... or pip3 install ....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.