Skip to content

Error starting camera: size in main stream should be (width, height) and OSError: [Errno 12] Cannot allocate memory #63

@olliraa

Description

@olliraa

I got around the type error (fixed in 3.5.4), but now when starting the server I get "Inernl error 500" in browaser and console shows this:

 File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 588, in sensor_modes
    self.configure(temp_config)
  File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 1210, in configure
    self.configure_("preview" if camera_config is None else camera_config)
  File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 1182, in configure_
    self.allocator.allocate(libcamera_config, camera_config.get("use_case"))
  File "/usr/lib/python3/dist-packages/picamera2/allocators/dmaallocator.py", line 43, in allocate
    fd = self.dmaHeap.alloc(f"picamera2-{i}", stream_config.frame_size)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/picamera2/dma_heap.py", line 98, in alloc
    ret = fcntl.ioctl(self.__dmaHeapHandle.get(), DMA_HEAP_IOCTL_ALLOC, alloc)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 12] Cannot allocate memory
[2025-07-07 13:09:10,752] ERROR in camera_pi: Thread 2530173952: CameraController.requestStart - Error starting camera: size in main stream should be (width, height)
[2025-07-07 13:09:10,778] ERROR in camera_pi: Thread 2530173952: CameraController.requestStart - Error starting camera: size in main stream should be (width, height)
[2025-07-07 13:09:12,861] ERROR in camera_pi: Thread 2530173952: CameraController.requestStart - Error starting camera: size in main stream should be (width, height)
[2025-07-07 13:09:12,866] ERROR in camera_pi: Thread 2530173952: CameraController.requestCameraForConfig - camera could not be started

If I refresh the browser I I can login, but preview (naturally) dos not work etc. Running on Zero w and latest Dietpi, is there some trick to get around this error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions