EdjeElectronics / TensorFlow-Object-Detection-on-the-Raspberry-Pi

A tutorial showing how to set up TensorFlow's Object Detection API on the Raspberry Pi
Apache License 2.0
1.14k stars 363 forks source link

File "/home/pi/.local/lib/python3.5/site-packages/cv2/__init__.py", line 3, in <module> error #31

Open VictorTagayun opened 5 years ago

VictorTagayun commented 5 years ago

This is my 2nd SD card having different error.. The 1st had a different error

pi@raspberrypi:~/tensorflow1/models/research/object_detection $ python3 Object_detection_picamera.py
Traceback (most recent call last):
  File "Object_detection_picamera.py", line 23, in <module>
    import cv2
  File "/home/pi/.local/lib/python3.5/site-packages/cv2/__init__.py", line 3, in <module>
    from .cv2 import *
ImportError: libcblas.so.3: cannot open shared object file: No such file or directory
Evantm commented 5 years ago

I had the same issue. You might be missing some dependencies, have you tried following the steps on this guide? https://blog.piwheels.org/how-to-work-out-the-missing-dependencies-for-a-python-package/

VictorTagayun commented 5 years ago

I did follow it and got these results

pi@raspberrypi:~ $ apt-file search libcblas.so.3
libatlas3-base: /usr/lib/atlas-base/libcblas.so.3
libatlas3-base: /usr/lib/atlas-base/libcblas.so.3.0
libatlas3-base: /usr/lib/libcblas.so.3
libcblas3: /usr/lib/arm-linux-gnueabihf/libcblas.so.3
libcblas3: /usr/lib/arm-linux-gnueabihf/libcblas.so.3.2.1

Installed "libcblas3" and "libcblas3-base", but now I got this error

pi@raspberrypi:~/tensorflow1/models/research/object_detection $ python3 Object_detection_picamera.py 
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "Object_detection_picamera.py", line 23, in <module>
    import cv2
  File "/home/pi/.local/lib/python3.5/site-packages/cv2/__init__.py", line 3, in <module>
    from .cv2 import *
ImportError: numpy.core.multiarray failed to import
VictorTagayun commented 5 years ago

I tried this also, same error.

pip install -U numpy

tjcooperforted commented 5 years ago

I also had the same issue of libjasper.so.1 in cv2 not being found. I looked at the ..../cv2 directory and saw only one directory and there are supposed to be two.

So I looked at the "install" steps I had done and re-ran: sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev

which had previously been done and showed no errors previously. When it was done I had both directories and then Object_detection..... now worked perfectly.

So I believe you can do an install and have it fail to get all the libraries made. Sometimes you have to do it twice. tjcooper