Skip to content

Commit

Permalink
Add caveats to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
will-v-pi committed Nov 28, 2023
1 parent 23ddabe commit 2ece2c4
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
# Pylibcamera
This package is for the libcamera python bindings only. It requires you to already have installed a version of libcamera onto your system.

## Caveats
***For most users this package is not the best approach to use libcamera in python - there are simpler ways***

**If you are able to use the system python**, then running `sudo apt install -y python3-libcamera` will install the libcamera python bindings in the simplest way.

**If you do require a virtual environment** (for example, in order to use a python package not available through apt) then the simplest way is to install the apt package and then create a virtual environment using system-site-packages.
```
sudo apt install -y python3-libcamera
python3 -m venv --system-site-packages my-env
```
This will allow you to use pip to install other packages in the virtual environment, while using the system versions of packages such as libcamera and PyQt5, which is a much simpler approach than pip installing these packages.

**If you must use this package** then be aware that there may be other troubleshooting required to get your virtual environment working correctly. For example, packages such as PyQt5 and OpenCV can require additional steps in order to pip install them, so it is much easier to apt install them and use a virtual environment with system-site-packages. If you have no other option but to use an isolated virtual environment (for example, if you require a different version of python to the system installed version), then this package will help with installing the libcamera python bindings, but be warned that other packages related to the camera will not be as easy to install.

## Installation Instructions
These instructions are designed for use in a python virtual environment. If you are using the system python then it is much simpler to install the system apt package for the libcamera python bindings (eg `sudo apt install python3-libcamera`), as these will match the version of libcamera correctly.
These instructions are designed for use in a python virtual environment. If you are using the system python then it is much simpler to install the system apt package for the libcamera python bindings (eg `sudo apt install -y python3-libcamera`), as these will match the version of libcamera correctly.

The default installation instructions (which work on Raspberry Pi OS) are:
```
sudo apt install -y libcamera-dev
pip install libcamera
pip install rpi-libcamera
```
If you have an older release of libcamera on your system then you may need to use `libcamera==version` to install the correct release.
If you have an older release of libcamera on your system then you may need to use `rpi-libcamera==version` to install the correct release.

### If you get a version error
If you get the error `This package works with libcamera version ..., but you have version ... installed`, then this means the version strings are not matching. If you have built your own version of libcamera, then just pass `-C setup-args="-Dversion=unknown"` to skip this check and follow the instructions in the next section. If you have a system installed version of libcamera then you will need to check this table for the correct pip package version to install, based on the version of libcamera you have installed. These are the common versions found on Raspberry Pis.
Expand All @@ -24,12 +38,12 @@ If you have built your own version of libcamera, or your system has a version wh

For example, the if you have built the master version of libcamera on your system, then you would run:
```
pip install libcamera -C setup-args="-Drevision=master"
pip install rpi-libcamera -C setup-args="-Drevision=master"
```

If you have built the main version from the Raspberry Pi repository then you would use:
```
pip install libcamera -C setup-args="-Drepository=https://github.com/raspberrypi/libcamera.git" -C setup-args="-Drevision=main"
pip install rpi-libcamera -C setup-args="-Drepository=https://github.com/raspberrypi/libcamera.git" -C setup-args="-Drevision=main"
```

## How it works
Expand Down

0 comments on commit 2ece2c4

Please sign in to comment.