Two years ago when I first built Otto, the conversational Slack bot, I used Rasa NLU. Since then, Rasa has released Rasa Core, which includes dialog management and task management. The Intent Engine can most definitely make use of those features. Rasa NLU ran fine on my old server in the basement that was aptly named einstein. However, I ran into some issues when trying to install Rasa Core on it.
pip install rasa core
it attempted to install Tensorflow, but failed. A dependency of Tensorflow is Bazel. I wish it was highlighted somewhere that Bazel requires a 64-bit platform. Einstein is 32-bit and therefore could not install rasa core via pip because Bazel was failing. I hope this saves someone else a lot of time.
Since my home server couldn’t handle Rasa Core I decided to try an AWS instance. I was eligible for the free tier so I stood up an EC2 t2.micro instance running Linux AMI.
First, I created a python3.5 virtual environment. Python3.6+ was failing when trying to install Twisted, which is why I went with Python3.5.
virtualenv -p python3.5 intentengine source intentengine/bin/activate
Then I followed the instructions on https://rasa.com/docs/core/0.13.2/installation/ to install rasa core.
That was failing due to some unknown reason so I jumped down to the github instructions
git clone https://github.com/RasaHQ/rasa_core.git
That failed too when I ran
pip install -r requirements.txt
To get Rasa Core to install properly I had to run the following commands:
sudo yum install python35 virtualenv -p python3.5 intentengine source intentengine/bin/activate cd intentengine sudo yum install gcc gcc-c++ make sudo yum install python35-devel sudo yum install libevent-devel sudo easy_install gevent pip install rasa_core pip install rasa_core_sdk pip install rasa_core_nlu[tensorflow]
OK Great. Now what? There’s a starter pack we can download and just modify to get better acquainted with Rasa Core.
Clone this repo to get started:
git clone https://github.com/RasaHQ/starter-pack-rasa-stack.git
After you clone the repository, a directory called starter-pack-rasa-stack will be downloaded to your machine. It contains all the files of this repo.
cd starter-pack-rasa-stack pip install -r requirements.txt
This command hangs and then gets killed each time I run it. The logs state the following
Feb 23 20:02:43 ip-172-31-80-203 kernel: [ 1304.652184] Out of memory: Kill process 2942 (pip) score 901 or sacrifice child
A t2.micro instance has 1GiB of memory. A t2.small has 2GiB of memory. View all Amazon EC2 Instance Types.
How do I increase the memory on a t2.micro instance so that it can finish installing spacy?
In the AWS console, you just stop the instance and select Instance Settings > Change Instance Type.
I changed it to the next instance type, which is t2.small. Let’s see if spacy still gets killed or not.
Apparently so. I’ll keep trying the next higher instance types until one works.
t2.micro pip install Spacy killed
t2.small pip install Spacy killed
t2.medium pip install success
To install spacy on an AWS EC2 instance you need somewhere between 2GiB and 4GiB of memory. The t2.medium instance comes with 4GiB memory.
The t2.medium instance shows:
Spacy Installing collected packages: spacy Successfully installed spacy-2.0.18
Now that spacy is installed I stopped the instance and changed it back to t2.micro.
Let’s finish the GitHub starter pack setup by installing the spaCy English language model
python -m spacy download en
Finally, everything was installed successfully. In the next post I’ll go through using the Rasa Core starter-pack. I’ll use those files as the basis for the NLU portion of the Intent Engine.