Rasa requires Python 3.6, 3.7 or 3.8. You can download Python here if you don't already have it installed.
To find out, which version of Python you have installed, execute:
Next, create a new folder named
mkdir rasa-dev-tutorial cd rasa-dev-tutorial
Because we don't want to instal our project dependencies on a system level, we will create a virtual environment.
python -m venv venv
This will create a folder
venv inside our project's folder.
Activate the virtual environment by running:
(You can deactivate the virtual environment by running
deactivate if you later need to.)
Next, install Rasa.
pip install rasa
If you need further help during the installation process, check out the Rasa documentation.
To create a basic Rasa project, run:
During the installation, you will be asked where to initialize the project. Hit enter to initialize the project in the current folder. Press
y when you are asked if it's okay that the folder already contains files.
A chatbot called Moodbot has been created.
You can try chatting with it for a while.
/stop to exit the chat.
This step provided us with the right folder structure and files we will need in the next steps.
Feel free to skip this part if you are familiar with git.
If you want to make this a git repository (strongly advised, this will allow us to version our code), run
git init and create a file
.gitignore with the following contents:
venv # exclude everything from models folder models/* # except for .gitkeep, so that the folder itself is included !models/.gitkeep
This will tell git to ignore virtual environment folder and models in models folder (models can be quite large, we will store them later on using GitHub Actions).
If anyone then clones the repository, they need to know which Python modules you used. Those are usually written in file
requirements.txt. Create this file by running:
pip freeze > requirements.txt
Add all files (that are not ignored) to git and commit them:
git add . git commit -m "Bootstrap project"
You can push your code to GitHub to safely store it and to be able to access it from anywhere. Create a new repository on GitHub named
Then, in your terminal in your project folder, run:
git remote add origin email@example.com:<username>/rasa-dev-tutorial.git git push --set-upstream origin master
Don't forget to replace the
<username> with your own GitHub username.
If you or anyone else wants to clone the repository, all they have to do is:
git clone firstname.lastname@example.org:<username>/rasa-dev-tutorial.git cd rasa-dev-tutorial python -m venv venv source venv/bin/activate pip install -r requirements.txt
To see a list of available Rasa commands, run:
We have already met
rasa init command, which creates a new project with example training data, actions, and config files.
To chat with the chatbot, you have to first train it using
rasa train and then start a chat in the terminal using
In the next chapter, we will look at the individual files that have been created and do some modifications to our chatbot.
Repository for this tutorial:
You can checkout the state of the repository at the end of this tutorial by running:
git clone --branch 01-creating-project email@example.com:petr7555/rasa-dev-tutorial.git