I have been trying out some OpenCv snippets as part of a larger robotics project such as Face Detection and Face Recognition. These have all been working on my MacBook. I am now trying to test out these programs on my Raspberry Pi running Bullseye on a PINN Lite setup.
I have been searching, finding and following various guides on how to install OpenCV correctly, but keep running into problems during installation. When I finally get an install working I then get problems importing cv2, either with numpy or pandas.
I am now following this guide:
I am now trying to install using this command:
pip install opencv-python
And noticed after removing the apt version of OpenCV and installing OpenCV through pip, it did not install a newer version of numpy suggesting that a version already existed from opencv-python 1.26.2.
Anyway here is the current output and it always seems to get stuck on
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting opencv-python
Using cached opencv-python-4.8.1.78.tar.gz (92.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.19.3 in ./.local/lib/python3.9/site-packages (from opencv-python) (1.26.2)
Building wheels for collected packages: opencv-python
Building wheel for opencv-python (pyproject.toml) ... -
This is where it gets stuck?
Any help would be great.
-
2Does this answer your question? Can't install Opencv on raspberry pi 4Milliways– Milliways2023年12月18日 23:29:00 +00:00Commented Dec 18, 2023 at 23:29
-
Not really - I seem to be going around in an infinite loop. Following the link you supplied I installed opencv using sudo apt install python3-opencv.Bill Harvey– Bill Harvey2023年12月19日 13:03:12 +00:00Commented Dec 19, 2023 at 13:03
-
Nope - I am going around in an infinite loop. Following the link I installed opencv using sudo apt install python3-opencv. I then re-ran my program and receive this warning: ImportError: this version of pandas is incompatible with numpy < 1.22.4 your version is 1.19.5. Please upgrade numpy to >= 1.22.4. I then ran pip install numpy --upgrade and then when running my program I get an error with libopenblas.so.0: cannot open shared object file: no such file or directory. I then followed a fix to resolve this which ends up downgrading numpy to 1.19 again and then I'm back with the numpy error.Bill Harvey– Bill Harvey2023年12月19日 13:23:46 +00:00Commented Dec 19, 2023 at 13:23
-
If you have run pip you have broken something. DO NOT use pip; get rid of what you installed (or restore from your backup) then install from apt (like the rest of us).Milliways– Milliways2023年12月19日 21:00:45 +00:00Commented Dec 19, 2023 at 21:00