Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Running [email protected] inside a docker container get Broken PIpe error. #1199

Open
DrChai opened this issue Jan 28, 2025 · 0 comments

Comments

@DrChai
Copy link

DrChai commented Jan 28, 2025

Python 3.11.11 (main, Jan  9 2025, 04:46:56) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libcamera
>>> libcamera.CameraManager.version
'v0.0.5+83-bde9b04f-dirty ()'
>>> from picamera2 import Picamera2, Preview
>>> picam2 = Picamera2()
[0:27:46.704043329] [17]  INFO Camera camera_manager.cpp:297 libcamera v0.0.5+83-bde9b04f-dirty ()
[0:27:46.808519116] [21]  WARN RPI vc4.cpp:383 Mismatch between Unicam and CamHelper for embedded data usage!
[0:27:46.809969693] [21]  INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media0 and ISP device /dev/media2
[0:27:46.810155840] [21]  INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/local/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
>>> preview_config = picam2.create_preview_configuration(main={"size": (800, 600)})
>>> picam2.configure(preview_config)
[0:27:53.333451265] [17]  INFO Camera camera.cpp:1033 configuring streams: (0) 800x600-XBGR8888 (1) 1640x1232-SBGGR10_CSI2P
[0:27:53.335407521] [21]  INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1640x1232-SBGGR10_1X10 - Selected unicam format: 1640x1232-pBAA
[0:27:55.341574894] [21] ERROR IPCPipe ipc_pipe_unixsocket.cpp:134 Call timeout!
[0:27:55.341687446] [21] ERROR IPCPipe ipc_pipe_unixsocket.cpp:66 Failed to call sync
[0:27:55.341720936] [21] ERROR IPAProxy raspberrypi_ipa_proxy.cpp:370 Failed to call configure
[0:27:55.341759582] [21] ERROR RPI pipeline_base.cpp:1201 IPA configuration failed!
[0:27:55.341806874] [21] ERROR RPI pipeline_base.cpp:567 Failed to configure the IPA: -32
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.11/site-packages/picamera2/picamera2.py", line 1004, in configure
    self.configure_(camera_config)
  File "/usr/local/lib/python3.11/site-packages/picamera2/picamera2.py", line 943, in configure_
    if self.camera.configure(libcamera_config):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Failed to configure camera: Broken pipe

I've been trying to run [email protected] in a docker container for the past week. The reason for using this specific version is that our project requires only picture captures from the camera to be sent to a server for vision modeling. We do not need streaming or video features (e.g., ffmpeg) and want to make it less footprint. Version 0.3.12 appears to be the latest stable version that does not depend on PyAV/ffmpeg. In addition, it is still the current version you can get when you apt install python3-picmaera2 from armhf package list(used on RPi zero).
To run this in an Alpine based container, I had to build nearly all dependencies from the source. The current error appears to be the final hurdle. From the error logs, the camera is detected, but the configuration fails. Upon looking at the line of the code, it seems to be a socket issue.

What I have done so far:

  • I can run [email protected] successfully in the host environment by installing the library via python3-picamera2. This uses the same versions of picamera2(0.3.12) and libcamera(v0.0.5+83-bde9b04f).
  • I tried to build it with Debian image and encountered the same result.
  • I tested it on RPi Zero, RPi 5 and RPI Zero2, the same result.
  • I can successfully build and run in a container using the same Docker build steps, but with the source updated to the latest version of picamera2 and libcamera.

Here are all the Dockerfiles and supporting files I used. Right now it works as expected with the latest source code hope it may help when this happens to other people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant