Ubuntu 24.04 comes with a newer Python version. But Rasa 3.6 only works with Python 3.8 to 3.10 Rasa Docs.
So we’ll install Python 3.10 from a trusted source called Deadsnakes :
# Update the system
sudo apt update && sudo apt upgrade -y
# Install software that allows adding repositories
sudo apt install -y software-properties-common
# Add the Deadsnakes PPA, source for old Python versions
sudo add-apt-repository ppa:deadsnakes/ppa -y
# Install Python 3.10
sudo apt install -y python3.10 python3.10-venv python3.10-dev
# Check the installed version
python3.10 --version
A virtual environment is like a clean space to install Rasa without affecting the ubuntu system :
# Navigate to the folder where we want to install the bot
cd ~
# Create a project folder
mkdir rasa-bot && cd rasa-bot
# Create the virtual environment
python3.10 -m venv venv
# Activate the virtual environment
source venv/bin/activate
If successful, the terminal prompt should now start with (venv).
Now that we are inside the virtual environment, we will install Rasa :
pip install --upgrade pip
pip install rasa==3.6.16
rasa --version
rasa init
You’ll be asked :
"Do you want to train an initial model?"
Type y and press Enter.
It will generate a sample chatbot project with folders like :
- data/ : where training examples are stored
- domain.yml : the brain of the chatbot (intents, actions, responses)
- config.yml : configuration settings for training
- actions/ : for custom Python code
Now we can talk to the bot:
rasa shell
Type messages like:
hello
what can you do?
bye
Type /stop
in rasa shell, and to exit the virtual environment type:
deactivate