google-coral / examples-camera

Small code snippets that show how to stream camera images to a Coral device.
Apache License 2.0
363 stars 114 forks source link

Issue with picamera library - Unable to find libmmal.so #107

Open Minoloi opened 1 year ago

Minoloi commented 1 year ago

Description

I am experiencing an issue with the picamera library on my Raspberry Pi. When running the classify_capture.py script from the google-coral examples, I encounter the following error:

Traceback (most recent call last): File "/home/admin/coral/pycoral/google-coral/examples-camera/raspicam/classify_capture.py", line 24, in import picamera File "/usr/lib/python3/dist-packages/picamera/init.py", line 72, in from picamera.exc import ( File "/usr/lib/python3/dist-packages/picamera/exc.py", line 41, in import picamera.mmal as mmal File "/usr/lib/python3/dist-packages/picamera/mmal.py", line 49, in _lib = ct.CDLL('libmmal.so') OSError: libmmal.so: cannot open shared object file: No such file or directory

I have already performed the following steps to address the issue:

Installed the required packages using sudo apt-get install libraspberrypi0 libraspberrypi-dev libraspberrypi-bin. Verified that the libmmal.so file exists in the /opt/vc/lib/ directory. Checked the permissions of the libmmal.so file and ensured that it is readable by the executing user. Upgraded the picamera library using sudo pip3 install --upgrade picamera. Despite these efforts, the issue persists, and the script is still unable to locate libmmal.so. I would appreciate any guidance or assistance in resolving this problem.

Thank you for your help!

Click to expand! ### Issue Type Bug ### Operating System Linux ### Coral Device USB Accelerator ### Other Devices Rapsberry Pi 4 ### Programming Language Python 3.9 ### Relevant Log Output ```shell Traceback (most recent call last): File "/home/admin/coral/pycoral/google-coral/examples-camera/raspicam/classify_capture.py", line 24, in import picamera File "/usr/lib/python3/dist-packages/picamera/__init__.py", line 72, in from picamera.exc import ( File "/usr/lib/python3/dist-packages/picamera/exc.py", line 41, in import picamera.mmal as mmal File "/usr/lib/python3/dist-packages/picamera/mmal.py", line 49, in _lib = ct.CDLL('libmmal.so') OSError: libmmal.so: cannot open shared object file: No such file or directory ```
Axxoul commented 1 year ago

Are you running Bullseye? Bullseye uses libcamera and therefor the example here is not valid anymore since picamera uses Raspberry Pi's legacy camera stack. picamera2 uses the new libcamera stack. Unfortunately I have not been able to make it work myself. You could try to enable the legacy stack in raspi-config. Did you find a solution in the meantime?