ubopod / ubo-hal

This repo includes code for communicating and interfacing with Ubo hardware peripherals
GNU General Public License v3.0
1 stars 2 forks source link

Installing picamera2 fails even with python-prctl installed #6

Closed zytegalaxy closed 1 year ago

zytegalaxy commented 1 year ago

Installing picamera2 fails even after installing python-prctl (sudo apt install python-prctl)

(ubo-venv) pi@ub0-108:~/ubo-sdk/camera $ pip3 install picamera2 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting picamera2 Using cached https://www.piwheels.org/simple/picamera2/picamera2-0.3.9-py3-none-any.whl (61 kB) Requirement already satisfied: numpy in /home/pi/ubo-venv/lib/python3.9/site-packages (from picamera2) (1.24.2) Collecting PiDNG Using cached pidng-4.0.9.tar.gz (21 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: pillow in /home/pi/ubo-venv/lib/python3.9/site-packages (from picamera2) (9.4.0) Collecting piexif Using cached https://www.piwheels.org/simple/piexif/piexif-1.1.3-py2.py3-none-any.whl (20 kB) Collecting python-prctl Using cached python-prctl-1.8.1.tar.gz (28 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [1 lines of output] You need to install libcap development headers to build this module [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

zytegalaxy commented 1 year ago

According to to picamera2 documentation, the python package must be installed using apt' instead ofpip`:

sudo apt install -y python3-picamera2

It must be noted that the virtual environment must be created with --system-site-packages flag to allow access to picamera2 package installed under system packages. This is because the libcamera Python bindings are not available through PyPI so you can’t install them explicitly afterwards. The correct command to do this would be:

python -m venv --system-site-packages my-env