These instructions are tailored towards running the photobooth on a Raspberry Pi (tested on 1B+ and 3B+). However, I use my standard Ubuntu Laptop (18.04) with the built-in webcam and OpenCV for development and as such, the app should work on any other hardware just as well. Simply skip the Raspberry Pi specific installation parts.
This is just for my own reference and maybe useful, if you have a similar hardware setup. Skip this, if you have your hardware already up and running.
Choose Raspbian Desktop instead of the Lite flavor, which lacks some packages required for the GUI.
Download and installation instructions are available at the Raspberry Pi website
Boot up the Raspberry Pi for the first time and open a terminal (press Ctrl+Alt+T). Enter the following to update everything to the latest version:
sudo rpi-update
sudo apt update
sudo apt dist-upgrade
Afterwards, open the configuration utility to adapt everything to your needs (e.g., setup WiFi, hostname, etc.)
sudo rpi-config
By default, Raspbian blanks the screen after ten minutes of idle time. You probably do not want that for a photobooth, thus it is best to disable this.
For that, edit /etc/lightdm/lightdm.conf
and change the startup command to the following:
xserver-command=X -s 0 -dpms
Configure any not working hardware, e.g., my touch screen needs some additional steps since some of the latest Raspbian releases. See the instructions at the end for my hardware setup.
If you plan on using a printer, make sure it is configured as default printer!
These dependencies are required to run the application. You might be able to skip some packages if you plan on not using gphoto2.
In a terminal, enter the following commands
sudo apt install python3-dev python3-pip virtualenv
sudo apt install qt5-default pyqt5-dev pyqt5-dev-tools # for PyQt5-GUI
sudo apt install gphoto2 libgphoto2-dev # to use gphoto2
sudo apt install libcups2-dev # to use pycups
If you want to use the gphoto2-cffi bindings you have to install the following packages:
sudo apt install libffi6 libffi-dev # for gphoto2-cffi bindings
Raspbian ships with a utility called gvfs
to allow mounting cameras as virtual file systems.
This enables you to access some camera models as if they were USB storage drives, however, it interferes with our use of the camera, as the operating system then claims exclusive access to the camera.
Thus, we have to disable these functionalities.
Note: This might break file manager access etc. for some camera models.
To remove these files, enter the following in a terminal:
sudo rm /usr/share/dbus-1/services/org.gtk.vfs.GPhoto2VolumeMonitor.service
sudo rm /usr/share/gvfs/mounts/gphoto2.mount
sudo rm /usr/share/gvfs/remote-volume-monitors/gphoto2.mount
sudo rm /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
sudo rm /usr/lib/gvfs/gvfsd-gphoto2
You should reboot afterwards to make sure these changes are effective.
These are the steps to install the application.
Run the following command to obtain the source code:
git clone https://github.com/reuterbal/photobooth.git
This will create a folder photobooth
with all necessary files.
To avoid installing everything on a system level, I recommend to initialize a virtual environment. For that, enter the folder created in the previous step
cd photobooth
and run the following command
virtualenv -p python3 --system-site-packages .venv
Activate the virtual environment. You have to do this whenever you open a new terminal or rebooted your hardware
source .venv/bin/activate
Run the following command to download and install all dependencies and the photobooth:
pip install -e .
Some dependencies are optional and must be included explicitly if you plan on using them. For that, change the above command to (note the lack of a whitespace after the dot)
pip install -e .[extras]
and replace extras
by a comma separated list (without whitespaces!) of the desired options.
These include:
pyqt
if you want to install PyQt5 from PIP (doesn't work on Raspbian)picamera
if you want to use the Raspberry Pi camera modulegphoto2-cffi
if you want to use thegphoto2-cffi
bindings
If not yet done, activate your virtual environment
source .venv/bin/activate
and run the photobooth as
python -m photobooth
Alternatively, use the Python binary of the virtual environment to start the photobooth directly without activating the environment first:
.venv/bin/python -m photobooth
This is useful, e.g., when starting the photobooth from scripts, desktop shortcuts, or when using an autostart mechanism of your window manager.
Change any settings via the "Settings" menu. Afterwards, select "Start photobooth" to get started. You can trigger the countdown via space bar or an external button.
To exit the application, use the Esc-key or an external button.
You can directly startup the photobooth to the idle screen (skipping the welcome screen) by appending the parameter --run
.