question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.camera_info': I/O error

See original GitHub issue

I’m using Raspberry Pi 3 Model B+.

vcgencmd get_camera gives me supported=1 detected=1

raspistill -o test.jpg gives me the test.jpg file but also gives this message

mmal: mmal_vc_shm_init: could not initialize vc shared memory service
mmal: mmal_vc_component_create: failed to initialise shm for 'vc.camera_info' (7:EIO)
mmal: mmal_component_create_core: could not create component 'vc.camera_info' (7)
mmal: Failed to create camera_info component

Then, I try to run this python code below, but it gives me this error message

from picamera import PiCamera
camera = PiCamera()

Error:

mmal: mmal_vc_shm_init: could not initialize vc shared memory service
mmal: mmal_vc_component_create: failed to initialise shm for 'vc.camera_info' (7:EIO)
mmal: mmal_component_create_core: could not create component 'vc.camera_info' (7)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 367, in __init__
    with mo.MMALCameraInfo() as camera_info:
  File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2346, in __init__
    super(MMALCameraInfo, self).__init__()
  File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 633, in __init__
    prefix="Failed to create MMAL component %s" % self.component_type)
  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.camera_info': I/O error

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:28

github_iconTop GitHub Comments

8reactions
BlackLightcommented, Nov 28, 2021

@6by9

For anyone who has written camera-based applications in the past, this is a very significant change, and is too large to be covered here. There will be a blog post dedicated to the new camera driver published soon, so watch this space!

I really don’t believe that this is the right way for the RPi Foundation to communicate such a big change, and I understand why many are frustrated with it.

There are thousands of scripts and examples out there that reference picamera, and they have been written over many years. There are even Android apps built around the way picamera streams video feeds. I have built many pieces of automation that leverage picamera to stream and record video between devices, and they’ve all been broken by the bullseye upgrade.

You can’t get away with a random blog post that says “hey guys, FYI we’ve decided to completely kill the old picamera API, we’ll let you know as soon as we have time how you are supposed to migrate your scripts”. You can’t even expect people to go through blog posts before a dist-upgrade to validate whether anything is going to break upon reboot. This is the best way to get developers pissed, and it has another unfortunate precedent (the way the omxplayer layer has been left to break and rot on its own without viable alternatives). What I would have expected:

  • The picamera relevant pages (Github, documentation and pypi) should have reported, in big capital letters and with reasonable notice before bullseye was released as a new stable, WARNING: This library is deprecated and is going to break in bullseye, [link to migration steps here]. If people are opening issues on this topic, it probably means that a breaking change wasn’t properly communicated.
  • A warning upon pip/apt install/upgrade (or import) of picamera on bullseye that clearly warns the user about the deprecation.
  • A back-compatibility layer: the v4l2 API is widely used and documented, but the picamera module provides an API that makes it easier to e.g. start a video stream or record with a preview even for a beginner, without having to mangle with ffmpeg/gstreamer/v4l2/gtk internals. The picamera module could have simply relied on e.g. a gstreamer wrapper instead of the proprietary interface, while providing the same external interface to maintain back-compatibility with previously written software. I’m pretty sure that lots of beginners out there would have loved a back-compatible way of writing a script to stream a camera feed in three lines of code.
  • A viable alternative: I’ve given the Pi camera a try with my ffmpeg and gstreamer Python streamers, and the performance is not at all comparable. This reminds me, again, about the messy deprecation of omxplayer: “omxplayer is falling apart, don’t use it anymore, use vlc instead, but we are also aware that vlc is not there yet when it comes to RPi integration”. When you deprecate something, make sure that you communicate it properly, and that you provide a satisfying alternative to the thing that you are deprecating.

We’re all happy to see the RPi software finally transition towards a more open-source approach, leaving behind legacy and hard-to-debug software like picamera or omxplayer. But we also expect the alternatives to be properly documented and supported. Many people out there rely on RPi software for stuff like media or camera playback: you can’t just break their software without providing and documenting the alternatives.

4reactions
6by9commented, Nov 9, 2021

You can still enable the legacy stack, but the default is now libcamera. https://forums.raspberrypi.com/viewtopic.php?t=323390

Python bindings for libcamera are already in the works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to create MMAL component b'vc.ril.camera': Out of ...
This error was resolved when I disconnected and reconnected my camera module. Somehow my camera module must have been wiggled loose when I ......
Read more >
picamera Failed to create MMAL component b'vc.camera_info'
from picamera import PiCamera cam = PiCamera(). and get error: picamera Failed to create MMAL component b'vc.camera_info': Function not ...
Read more >
failed to create component 'vc.ril.camera' (1:ENOMEM)'
Problem: You are trying to acess the Raspberry Pi camera using raspistill or raspivid , but you see an error message like this:....
Read more >
PiCamera() error. How do I fix this problem? - Stack Overflow
... raise PiCameraMMALError(status, prefix) picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.camera_info': I/O error.
Read more >
16. API - mmalobj — Picamera 1.13 Documentation
Control ports are used to accept and receive commands, configuration parameters, and error messages. All MMAL components have a control port, but in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found