1

I recently bought a Raspberry Pi 3b+ and Camera module v3. After days of troubleshooting, I got the camera to spit out images on the libcamera CLI. But, I can't create a picamera.PiCamera object in Python. Here's my error:

Python 3.9.2 (default, Mar 12 2021, 04:06:34) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from picamera import PiCamera
>>> camera = PiCamera()
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 456, in _init_camera
    self._camera = mo.MMALCamera()
  File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2279, in __init__
    super(MMALCamera, self).__init__()
  File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 631, in __init__
    mmal_check(
  File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
    raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.ril.camera': Out of memory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 431, in __init__
    self._init_camera(camera_num, stereo_mode, stereo_decimate)
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 459, in _init_camera
    raise PiCameraError(
picamera.exc.PiCameraError: Camera is not enabled. Try running 'sudo raspi-config' and ensure that the camera has been enabled.

Using libcamera, I don't get any errors. But, when I try creating a PiCamera object, it fails, giving the above error. Please help!

Here's my specs:

  • Raspberry pi 3b+
  • Raspberry Camera Module 3
1
  • Ooh. Thanks for pointing out the mistake!
    – N3RDIUM
    Commented Mar 19, 2023 at 10:53

1 Answer 1

3

The old camera stack with Picamera will not be updated for the new v3 camera. You will have to swap to the Picamera2 modules.

5
  • I'm fairly new to RPi. Can you please tell me how I'm supposed to do that?
    – N3RDIUM
    Commented Mar 18, 2023 at 15:17
  • Also, I get cannot import name PiCamera2 from picamera2 when I try to use PiCamera2.
    – N3RDIUM
    Commented Mar 18, 2023 at 15:34
  • Great, now I get Exception: EGL_EXT_image_dma_buf_import missing
    – N3RDIUM
    Commented Mar 18, 2023 at 15:42
  • TYSM, it works now!
    – N3RDIUM
    Commented Mar 18, 2023 at 15:53
  • 1
    @N3RDIUM FYI: there is a lot if documentation available at raspberrypi.com/documentation/computers/camera_software.html, including a doc fot picamera2
    – Dirk
    Commented Mar 18, 2023 at 16:38

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.