How to install Whisper (Speech to Text) on the Raspberry Pi 5

Learn how to install and set up Whisper for accurate speech-to-text conversion on your Raspberry Pi 5.

Written By: Cherie Tan

Dash icon
Difficulty
Easy
Steps icon
Steps
5
 Whisper is a powerful speech-to-text tool that can transcribe spoken language into written text with high accuracy. This guide provides detailed instructions on how to install and set up Whisper on a Raspberry Pi 5. After completing this guide, you will be able to leverage Whisper's capabilities to convert speech into text on your Raspberry Pi. WIth that, you'll be able to enhance your projects with voice recognition technology!

Step 1 Checking Kernel Version and Preparing Raspberry Pi Lite Image

This command will provide the kernel version specific to the Raspberry Pi's operating system: uname -r
The uname -a command in Unix-like operating systems provides comprehensive system information: uname -a
After finding out the version, if it is a Lite image install, there are a couple of things you need to do first. With the command to update package lists:
sudo apt-get update

Install Python 3 pip and Git:
sudo apt-get install python3-pip git


Step 2 Cloning and Setting Up the whispercpp Repository

Now clone the repository with the command: git clone https://github.com/AIWinterMuteAI/whispercpp.git
Then navigate to the new directory with the  command: 
cd whispercpp

Navigate back to the parent directory: cd ..

This command installs the build package using pip, which is required for building and packaging Python projects.: pip install build

Step 3 Creating a Python Virtual Environment

 The command python3 -m venv whisper --system-site-packages sets up a new Python virtual environment named whisper:
python3 -m venv whisper --system-site-packages

This command activates the whisper virtual environment. Once activated, the prompt typically changes to indicate the active virtual environment ((whisper) in the prompt):
source whisper/bin/activate

This command uses pip to install the build package within the active whisper virtual environment. The build package is essential for building and packaging Python projects:
pip install build

Step 4 Building the whispercpp Project

Navigate to the project directory, where the project files are located:
cd whispercpp/

Run the build command:
python3 -m build -w

Step 5 Installing a Python Package and Running Script

Install a Python package from a Wheel file:
pip install dist/*.whl
Note: Wheel files (*.whl) are a built-package format for Python, designed to be easier to install than source distributions (*.tar.gz). By running this command, you install the Python package(s) contained in the specified Wheel file(s) into your Python environment.

Navigate to a specific directory:
cd examples/stream/

Run a Python script:
python stream.py