TensorFlow-Object-Detection-on-the-Raspberry-Pi icon indicating copy to clipboard operation
TensorFlow-Object-Detection-on-the-Raspberry-Pi copied to clipboard

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

Open VictorTagayun opened this issue 6 years ago • 4 comments
trafficstars

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

VictorTagayun avatar Jan 20 '19 01:01 VictorTagayun

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/

Evantm avatar Jan 28 '19 01:01 Evantm

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 avatar Jan 28 '19 23:01 VictorTagayun

I tried this also, same error.

pip install -U numpy

VictorTagayun avatar Jan 28 '19 23:01 VictorTagayun

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

tjcooperforted avatar Mar 25 '19 04:03 tjcooperforted