It used to be possible to talk to a Pi camera module from Python without having to install a desktop environment, using the picamera library. I understand that this has long since been replaced by libcamera and picamera2, since picamera relied on the closed source MMAL library. Now I have perhaps a somewhat unusual requirement in that I would like to capture a still photo using a Pi 3B running Bookworm that has no screen or keyboard attached to it - and while python3-libcamera installs without issue, when I try to install python3-picamera2 it wants to pull in the full desktop environment:
Needless to say I'm not willing to do that. I imagine it should be possible to use python3-libcamera in Python to capture a still image, but haven't been able to find any example code to get started with. Any tips?
Code:
$ sudo apt-get install python3-picamera2...0 upgraded, 276 newly installed, 2 to remove and 0 not upgraded.Need to get 184 MB of archives.After this operation, 622 MB of additional disk space will be used.Do you want to continue? [Y/n] nAbort.Statistics: Posted by Lomax — Wed Dec 10, 2025 12:28 pm