In this post, I am going to walk through some issues that I recently encountered when attempting to get up and running with the Rasa stack.. I am a big fan of the work they are doing, and by and large, it makes a complex problem, chatbot development, accessible and leverages machine learning under the hood. This is in contrast to tools that levergae simple rule-based approaches.
Below we will be using conda to manage our python environments and ensure that the package dependencies align. I will assume that you have conda properly installed, and will later show how to get the toolset configured on a Digital Ocean droplet.
Why this post
Previously, installing rasa was a breeze. Admittedly I never really had issues until recently. I am uncertain if the issue occurred on my machine with the new Mac OS (I am a Mac user), or if new features were added and downstream dependencies were missing from my machine. Regardless, I want to remind myself of how I was able to fix the issue with the help of this Github Issue. I will do the setup on a Mac, as well as a simple cloud droplet on Digital Ocean.
Install on a Mac
The first thing that we need to do is create an environment in conda. An environment encapsulates our tooling and helps avoid issues where an upgrade to a python package could break your ability to run your previous code. Basically, use environments whenever possible.
conda create -n rasabot python=3.6
With above, the conda tool will manage the dependencies for you and get a base install of python 3.6 contained with an environment called
rasabot. Let’s activate this environment:
source activate rasabot
On my machine, my terminal now tells me that I am in the rasabot environment
(rasabot) QST-ML-0208:brocktibert btibert$
Ok, one thing that I want to do is enforce my version of numpy. Let’s install that below.
pip install numpy==1.14.5
Ok, with that covered, let’s get Rasa Core setup.
pip install rasa_core
As noted from the solution on the Github ticket, your machine may need to have the Mac Command Line tools installed (which is found in the Stackoverflow Answer). In short, you will create an Apple Developer account and install the tool as described here.
Ok, with rasa seemingly good to go, let’s validate:
python -c "import rasa_core; print(rasa_core.__version__)"
Ok, we also will want to leverage Rasa NLU. We will install that below.
pip install rasa_nlu[tensorflow]
And we will do the same for validation:
python -c "import rasa_nlu; print(rasa_nlu.__version__)"
We are off to the races.
Setup on Digital Ocean
In addition to local dev, I wanted to make sure that I could spin up rasa in the cloud. I really enjoy using Digital Ocean, but this is applicable anywhere.
Once you have ssh’d into your remote box:
apt-get update apt-get install apt-get install libxml2-dev libxslt-dev sudo apt-get install gcc wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh exit conda create -n rasabot python=3.6 source activate rasabot pip install numpy==1.14.5 pip install rasa_core pip install rasa_nlu[tensorflow]
Above, when you install Miniconda, you will be prompted to hit enter and confirm the locations. I accepted all of the defaults.