I'm working on a camera system based on a raspberry pi 5 (8gb), with a brand new (2023-12-05 and updated) standard Raspbian 64x, and my python codes are running in a virtual enviroment (venv).

I would like to use picamera to capture raw images, but I get an error in the first line install picamera. The error is because of the missing libmal.so file (or libraspberrypi-dev package), but it is a default library on raspbian.

There is a short example code with the error messages:

import picamera

with picamera.PiCamera() as camera:
    camera.capture('/home/pi/Desktop/image.dng', format='dng')


Traceback (most recent call last):
  File "/home/pi/Desktop/project/tests/camteszt5.py", line 1, in <module>
    import picamera
  File "/home/pi/Desktop/project/.venv/lib/python3.11/site-packages/picamera/__init__.py", line 72, in <module>
    from picamera.exc import (
  File "/home/pi/Desktop/project/.venv/lib/python3.11/site-packages/picamera/exc.py", line 41, in <module>
    import picamera.mmal as mmal
  File "/home/pi/Desktop/project/.venv/lib/python3.11/site-packages/picamera/mmal.py", line 49, in <module>
    _lib = ct.CDLL('libmmal.so')
  File "/usr/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libmmal.so: cannot open shared object file: No such file or directory

I've tried installing the libraspberrypi-dev package, which should include the libmmal.so file, but the issue persists. I've also tried searching for the libmmal.so file with the find command, but it doesn't seem to be present on my system.

I've also tried reinstalling the picamera module and creating a Python virtual environment, but neither of these solutions have resolved the issue.

Does anyone have any suggestions for how to resolve this issue? Any help would be greatly appreciated.

Thank you.

  • 1
    Which OS do you use? On bookworm you would use the libcamera stack and you need picamera2 instead of picamera
    – Dirk
    Jan 6 at 18:44
  • @Dirk Thanks for the answer, I'll check the libs. I edited the question, but I use raspberry pi os standard version. Do you need more specific? Thank you!
    – Domkrt
    Jan 6 at 19:02
  • There is not, never has been and never will be a Raspbian 64. Raspbian is a 32bit armhf OS.
    – Milliways
    Jan 7 at 7:16
  • @Milliways you're right, I tested it on x32 and all the errors were resolved.
    – Domkrt
    Jan 7 at 15:53

1 Answer 1


The solution was to use the x32 system, based on the comments. This solved all my problems.

I hope it can help others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.