This guide was originally written for Raspberry Pi OS Buster, with the original Picamera library. When Raspberry Pi released Bullseye, they did so with a promise that eventually there would be a new Picamera2 library that was built on top of the libcamera subsystem. While it was possible to install Picamera2, it was a very involved process that was not friendly to the average user and still highly experimental.

Nearly a year later, they started including Picamera2 with Raspberry Pi OS by default, so it was time for a guide update. The installation path that this updated guide uses is designed to make it as easy as possible for you to get a Raspberry Pi up and running with TensorFlow.

The overall installation path will be to using the 64-bit version of the Raspberry Pi Desktop because recent versions of TensorFlow are no longer compiling for the 32-bit OS and the QT OpenGL graphics drivers are installed by default on the Desktop version.

Image Installation

You're going to get started using the latest Raspbian Pi OS Desktop. Start by downloading and installing the latest Raspberry Pi Imager, which makes it super easy to customize all your settings before you even write the image to the SD Card.

Use the imager to burn the operating system image to a Micro SD Card. Raspberry Pi has provided a quick video overview available to watch.

Select the 64-bit Raspberry Pi OS Bullseye Desktop image by going to Raspberry Pi OS (Other)Raspberry Pi OS (64-bit).

You can customize settings for your Pi by clicking the gear icon in the lower righthand corner after choosing your OS.

Make sure to enable SSH, set a good username and password, set your WiFi credentials, and update the locale settings to your specific needs.

Log In

After properly unmounting ("ejecting") your card for you computer, go ahead and place the microSD card in the Pi and supply power to boot it up. It may take a few minutes before it's available.

On your computer, assuming you left the username as pi and the hostname as raspberrypi.local, SSH into the card using the following:

ssh [email protected]

If you changed your username or hostname settings in the imager, use those instead.

Update the Raspberry Pi

Update the Pi

sudo apt update
sudo apt upgrade -y
sudo apt install -y python3-pip
sudo apt install --upgrade -y python3-setuptools

Setup Virtual Environment

If you are installing on the Bookworm version of Raspberry Pi OS, you will need to install your python modules in a virtual environment. You can find more information in the Python Virtual Environment Usage on Raspberry Pi guide. To Install and activate the virtual environment, use the following commands:

sudo apt install python3.11-venv
python -m venv env --system-site-packages

You will need to activate the virtual environment every time the Pi is rebooted. To activate it:

source env/bin/activate

If needed, you can use deactivate, but leave it active for now.

Upgrade Script

We put together a script to easily make sure your Pi is correctly configured and install Blinka. Although Blinka isn't required for this to work, it's nice to have and this script also enables several other interfaces that are required for this project to work. It requires just a few commands to run. Most of it is installing the dependencies.

cd ~
sudo pip3 install --upgrade adafruit-python-shell
wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/raspi-blinka.py
sudo python3 raspi-blinka.py

If your system default Python is Python 2 (which usually is no longer the case with the recent versions of Raspberry Pi OS), it will ask to confirm that you want to proceed. Choose yes.

It may take a few minutes to run. When it finishes, it will ask you if you would like to reboot. Choose yes.

This guide was first published on Sep 04, 2019. It was last updated on Mar 08, 2024.

This page (Initial Setup) was last updated on Mar 08, 2024.

Text editor powered by tinymce.