For starting the camera I am doing

>>> import picamera 
>>> camera = picamera.PiCamera()
mmal: mmal_vc_component_enable: failed to enable compononent : ENOSPC
Traceback (most recent call last):
  File "<stdin>", line, in <module>
picamera.exc.PiCameraMMALError: Camera component couldn't be enabled: Out of resources (other than memory)

I checked lot of answers which told to update the package and I did that but nothing seems to help. IS my camera gone or is there some solution?


14 Answers 14


As an addition to the other answers, I just want to mention that the cause for this error could also be that another process is currently using the camera.

  • 2
    I think you could be right. I started to get this error after interrupting a camera script that wasn't responding (using CTRL-C). Camera was working fine prior to this. So how do I release/reset the camera so it works again?
    – Bill
    Jul 2, 2016 at 4:19
  • In my case, motion library was using the camera. Running sudo service motion stop solved my problem Apr 28, 2020 at 10:55

The Raspberry Pi Camera Module uses the onboard GPU and its memory. Since your error message mentions being out of resources, consider adding at least (and possibly more than) the recommended minimum of 128MB to the GPU's allotment.

To change it:

sudo raspi-config

select: Advanced options -> Memory split -> and set at least 128MB

Some users report this message disappearing after changing the GPU memory allotment to 256MB from 128MB.

  • This was the case for me. After an update, 128MB were not enough anymore, I had to set it to 256MB. Jun 6, 2018 at 13:14

The solution is to ensure that the line, camera = PiCamera() is outside of any loop or function.

If the line camera = PiCamera() is called every time your function runs then the Camera runs out of memory.

camera = PiCamera()

def Take_an_Image():

    camera.resolution = (1024, 768)
  • It doesn't appear that this specific error was due to running out of memory (the error was "Camera component couldn't be enabled: Out of resources (other than memory)"), and the OP didn't declare their camera in a loop, but this is good advice if someone does run out of memory.
    – Aurora0001
    Jan 7, 2018 at 12:12

I ran into this same problem with the Rasp Pi 3. I started a python script that would take 1 image per second for a minute. I hit ctrl-z to interrupt script execution about halfway through. When I tried to run the script again, I got this error, although it appeared that no other scripts were using the camera.

The fix: Enter "ps -a" to list all of the currently running processes. Look for one that says "python" or "python3" in the output, like this:
PID TTY TIME CMD 1218 tty1 00:00:00 bash 2203 pts/0 00:00:00 python 8960 pts/1 00:00:00 ps

Use the command "kill -KILL [PID#]" to stop the python process. For this case, the command was "kill -KILL 2203".

After doing this, use "ps -a" again to make sure the python process is not listed.

This cleared up the problem for me, and I was able to run my script again without any issues.

Hope this helps.

  • Ctrl-Z just pauses execution. Use Ctrl-C to abort the script. To kill a process paused by Ctrl-Z, you can use kill %1, at least in Bash.
    – moi
    Feb 28, 2021 at 11:15

Follow this order of commands:

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo rpi-update

The last one is very important if you bought your Raspberry a long time ago, AND if you want some new features.


For anyone else with this problem... if the light is on at boot then you really might have the wrong ribbon cable port! The cable will fit nicely into the LCD port and the light will turn on and everything. But you will get the error saying to enable the device.

Werner pointed this out: https://blog.adafruit.com/wp-content/uploads/2014/01/1646pi_LRG-600x461.jpg


In my code there was a silly bug that gave raise to this error: I opened the camera once, but intentionally tried to open it again when the user clicks a hardware button. Closing the camera before the second call to PiCamera() resolved the problem.


In addition to alcor's answer, make sure you run raspi-config, and choose option 5 after you boot up, to enable camera support.

I think you might need to use sudo


So it turns out that Camera port of my Raspberry Pi had some problem. Replaced the Pi, camera is working smoothly.


I ran into same issue. I realized that since I was broadcasting video via httpd, I could not make use of the images via Python. I had to choose to either let the Python script access the images or let the Apache server make video available via browser. Only one process can access the camera at a time.


I had this ressource issue, it turned out the fonction camera.capture(filename) was the problem, because the file already existed.


For my case, having the same error, replacing the camera module fixed it. I was able to reliably reproduce the error by switching back and forth between good and bad camera modules. My code did not suffer from the problems others pointed out. So it seems hardware problems can cause this exception too.

The exception was:

picamera.exc.picamerammalerror: failed to enable connection: out of resources

Picamera version is 1.13 and the camera module is v2.1

  • I had an issue with a defective ribbon giving the same error. I am guessing that this part in particular is the most damage prone part of the camera module —luckily it's the easiest to fix. Dec 31, 2020 at 15:05

You will get this error if your button is not properly connected. The Pi will think the button is pressed and continually try to take photos, hence you will be out of resources!

Make sure your button is plugged into the correct GPIO pin and then continue to other methods of debugging.


Just my penny worth.. I wrote a small program that takes a sequence of pics. It worked fine in IDLE, but from command line came up with exact same error being out of resources. The problem was fixed by adding camera.close() after except KeyboardInterrupt:, ie Ctrl+C (in the python shell). for when you need to break out of a loop.

  • Thanks for your answer. Because it's your first answer, I've been prompted by the system to review it, and make any comments that might help you improve it. I'm struggling to understand what your proposed answer is. Please try to be more specific; e.g. provide some code that you feel will resolve the issue. I'd also recommend you read "How to write a good answer". Please consider these suggestions, and edit your answer accordingly.
    – Seamus
    Sep 16, 2018 at 18:13

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