I am an absolute noob at this since I started recently. I am installing OpenCV for Tensorflow for a project. How To Run TensorFlow Lite on Raspberry Pi for Object Detection is the video i am using. I have Bookworm installed, on a Raspberry Pi 5
pip3 install opencv-python==3.4.11.41
is the command that I am running, although I get this error:
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
×ばつ Encountered error while trying to install package.
╰─> numpy
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-e×ばつ pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
I have tried almost all the random solutions on the web, I have tried sudo apt-get
, pip3
, although nothing is working.
-
The problem seems to be more with NumPy rather than OpenCV...Greenonline– Greenonline ♦2024年09月06日 15:48:26 +00:00Commented Sep 6, 2024 at 15:48
1 Answer 1
At a guess, as you don't specify, you are probably using Python 3.7.
opencv-python
3.4.11.41 doesn't provide wheels for Python 3.7, at most 3.6. As OpenCV will have a dependancy on NumPy, the versions are probably mismatched, leading to the numpy
error during the install.
For such an old version of opencv-python
either:
- use an older version of Python, or;
- compile from sources (which is hard)
A much better solution would be to use the latest version of opencv-python
. That video is over four years old, and so the versions used are probably out-of-date, or no longer supported. Just use the latest (compatible) versions of the software.
So enter instead, without the version requirements:
pip3 install opencv-python