System: Raspberry Pi 4 model B, use external USB Logitech camera
I'm follow the youtube tutorial but get picamera.exc.PiCameraMMALError
andpicamera.exc.PiCameraError
Relate discussion on other site 2021 (I didn't get their solution): "Camera issue, no idea what the problem is"
https://forums.raspberrypi.com/viewtopic.php?t=324702
- The python code:
from picamera import PiCamera
import time
print("= = = = = == = = = ")
camera = PiCamera()
camera.start_preview()
time.sleep(2)
camera.capture("test.jpg")
- The whole output:
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 "/home/joy/Desktop/camera.py", line 6, in <module>
camera = PiCamera()
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.
- The youtube tutorial I follow:
How to Take Photos and Videos with Raspberry Pi Camera Module
https://www.youtube.com/watch?v=nx8gDSS1vO4&list=PLnjnmu-sbNYMvMiXd-y5t7fYts1N0hmuI&index=3&t=331s&ab_channel=TechWithTim
- Troubleshooting:
(Camera is not enabled. Try running 'sudo raspi-config' and ensure that the camera has been enabled.
--> The follow picture I just make sure the camera is enable, maybe because I used external usb logitech camera )
https://ibb.co/Jyxtbfv
https://ibb.co/CHrWRH1
I'm the python beginner, and first day have Raspberry Pi, stocking on camera setup, how can I fix this?
whether can use USB camera or Original Design Manufacturer aka raspberry pi 4's camera
cause I thougt the logic is same and just want to test before I really purchase new item, and if so, for the code part how can I improve