Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing libmmal.so with picamera library

Tags:

python

After installing the picamera library using pip, whenever I import the library I get this error:

OSError: libmmal.so: cannot open shared object file: No such file or directory

I am running ubuntu 14.04, with python 2.7.6.

When I attemt to search for this elusive libmmal.so:

$ sudo find / -name libmmal.so
/root/mounts/backups/root/opt/vc/lib/libmmal.so
/root/mounts/root-backup/opt/vc/lib/libmmal.so

Both of which are backups of my raspberry pi, and are therefore irrelevant.

like image 874
Pinico Avatar asked Nov 15 '25 04:11

Pinico


1 Answers

I had the same problem using Raspbian based on Debian Bullseye, so if you install the Raspbian Lagacy and activate the camera everything should work properly. But if you want to use Rasbian based on Debian Bullseye then proceed the following steps:

  • Make sure that the camera is properly connected to the camera port with flat cable and Legacy camera is activated under raspi-config -> interfaces

  • Update:

    sudo apt update
    
  • Check if the path for libmmal.so exists under /opt/vc/lib or /lib/arm-linux-gnueabihf/:

    sudo ldconfig -p | grep mmal
    
  • If not, update Raspberry Pi firmware and reboot:

    sudo rpi-update
    sudo reboot
    
  • Check if there exists video0 under /dev: ls /dev/, then it should works.

  • If not, it is recommended to increase the GPU memory (under Performance Options -> GPU Memory) to >=128MB and then add the following to the /boot/config.txt:

    start_x=1
    
  • Read/enable the raspberry pi camera module:

    modprobe bcm2835-v4l2
    
  • To load the module automatically add bcm2835-v4l2 to /etc/modules.

  • Reboot and then video0 should be appeared under /dev.

  • Test the camera:

    from picamera import PiCamera
    from time import sleep
    
    camera = PiCamera()
    
    camera.start_preview()
    sleep(5)
    camera.stop_preview()
    
like image 61
Keivan Avatar answered Nov 17 '25 20:11

Keivan