Hi all. Because Rasa uses Tensorflow we’ve been experiencing some pip-related hardship getting installations to work on the new apple M1 macbooks. I think we’ve found a temporary workaround for the situation, but it’s important to emphesize that this workaround is very much temporary. Hopefully, these steps won’t be needed in the future when the Tensorflow/pip incompatibilities are adressed.
An unofficial guide to getting Rasa to work on a M1 Macbook.
What follows below is a step-by-step guide that explains how I got Rasa to work on a M1 Macbook Air. These steps seem to work on MacOS Montery v12.0.1. If you use an ealier version of the operating system you’ll likely need to upgrade. This guide was written on Feb 14th 2021. While we might try to keep this thread up-to-date, it is likely that things might change depending on the Tensorflow support for these devices.
Step One: System Dependencies
First, you’ll want to install some base dependencies for your operating system. We will use brew for this. If you don’t have brew installed you can do so by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The script explains what it will do and then pauses before it does it. Once brew is installed you can install the required system dependencies.
brew install libpq libxml2 libxmlsec1 pkg-config postgresql
Step Two: Conda
Next, we will install conda to deal with our dependencies. We will follow the steps that are described here as a reference.
You can install conda by downloading this file and running it locally via;
chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate
This will activate an environment that is maintained by conda. That means that conda is able to handle our Tensorflow dependencies from here on. Conda does not work with requirements.txt
files that you may be familiar with from pip
. Instead we will use a env.yml
file. Here’s the one that will use:
channels:
- apple
- conda-forge
dependencies:
- python==3.8.12
- dask==2021.11.2
- tensorflow-deps==2.6.0
- numpy>=1.19.2,<1.20.0
- scipy>=1.4.1,<1.8.0
- scikit-learn>=0.22,<0.25
- matplotlib==3.5.1
- pip
- pip:
- absl-py==0.13.0
- aio-pika==6.8.1
- aiofiles==0.8.0
- aioredis==2.0.1
- aioresponses==0.7.2
- aiormq==3.3.1
- anyio==3.4.0
- APScheduler==3.7.0
- async-generator==1.10
- async-timeout==4.0.2
- aiohttp==3.8.1
- httpcore==0.11.1
- httplib2==0.20.2
- httptools==0.3.0
- httpx==0.15.4
- bidict==0.21.4
- blinker==1.4
- boto3==1.20.28
- botocore==1.23.28
- CacheControl==0.12.10
- cachy==0.3.0
- certifi==2021.10.8
- chardet==4.0.0
- clang==5.0
- cleo==0.8.1
- clikit==0.6.2
- colorama==0.4.4
- colorclass==2.2.2
- coloredlogs==15.0.1
- colorhash==1.0.4
- crashtest==0.3.1
- croniter==1.1.0
- cytoolz==0.11.2
- decorator==5.1.0
- defusedxml==0.7.1
- distlib==0.3.4
- dm-tree==0.1.6
- docopt==0.6.2
- fakeredis==1.7.0
- fbmessenger==6.0.0
- filelock==3.4.2
- fire==0.4.0
- flatbuffers==1.12
- freezegun==1.1.0
- future==0.18.2
- gitdb==4.0.9
- GitPython==3.1.3
- google-auth==2.3.3
- google-pasta==0.2.0
- h11==0.9.0
- HeapDict==1.0.1
- html5lib==1.1
- humanfriendly==10.0
- isodate==0.6.1
- jmespath==0.10.0
- jsonpickle==2.0.0
- jsonschema==3.2.0
- kafka-python==2.0.2
- keyring==21.8.0
- locket==0.2.0
- lockfile==0.12.2
- lxml==4.7.1
- mattermostwrapper==2.2
- mock==4.0.3
- multidict==5.0.0
- munkres==1.1.4
- mypy_extensions==0.4.3
- networkx==2.6.3
- oauth2client==4.1.3
- onelogin==2.0.2
- packaging==20.9
- pamqp==2.3.0
- pastel==0.2.1
- pexpect==4.8.0
- pika==1.2.0
- pkgconfig==1.5.5
- pkginfo==1.8.2
- platformdirs==2.4.1
- poetry==1.1.12
- poetry-core==1.0.7
- prompt-toolkit==2.0.10
- protobuf==3.19.1
- psycopg2-binary==2.9.3
- ptyprocess==0.7.0
- pyasn1==0.4.8
- pyasn1-modules==0.2.7
- pydot==1.4.2
- pykwalify==1.8.0
- pylev==1.4.0
- pymongo==3.10.1
- pyrsistent==0.18.0
- pyTelegramBotAPI==3.8.3
- python-crfsuite==0.9.7
- python-engineio==4.3.0
- python-socketio==5.5.0
- python3-saml==1.12.0
- questionary==1.10.0
- randomname==0.1.5
- redis==3.5.3
- regex==2021.8.28
- rfc3986==1.5.0
- rocketchat-API==1.16.0
- ruamel.yaml==0.16.13
- ruamel.yaml.clib==0.2.2
- s3transfer==0.5.0
- sanic==21.6.0
- sanic-jwt==1.7.0
- sanic-plugin-toolkit==1.2.1
- sanic-routing==0.7.0
- sanic-cors==1.0.0
- sentry-sdk==1.3.1
- shellingham==1.4.0
- simple-image-download==0.2
- sklearn-crfsuite==0.3.6
- slackclient==2.9.3
- smmap==5.0.0
- sniffio==1.2.0
- SQLAlchemy==1.4.29
- tabulate==0.8.9
- tarsafe==0.0.3
- tensorboard==2.7.0
- tensorflow-estimator==2.6.0
- tensorflow-hub==0.12.0
- tensorflow-macos==2.6.0
- tensorflow-metal==0.3.0
- tensorflow-probability==0.13.0
- termcolor==1.1.0
- terminaltables==3.1.10
- tfa-nightly==0.16.0.dev20220103155136
- tomlkit==0.8.0
- tqdm==4.62.3
- twilio==6.50.1
- typeguard==2.13.3
- typing-utils==0.1.0
- tzlocal==2.1
- ujson==4.3.0
- uvloop==0.14.0
- virtualenv==20.13.0
- wcwidth==0.2.5
- webencodings==0.5.1
- webexteamssdk==1.6
- websockets==9.1
- zict==2.0.0
- requests-toolbelt==0.9.1
- requests==2.26.0
- requests-oauthlib==1.3.0
- requests-toolbelt==0.9.1
Given such an env.yml
file, we can create a new environment. We’ll use the rasatest
name for the environment.
conda env create -v --name rasatest -f env.yml
Once these dependencies are installed we can active our environment.
conda activate rasatest
Step Three: Rasa
At the time of writing this tutorial you’ll need to install the Rasa dependencies manually from git. The versions shown below have been tested beforehand and seem to work!
pip install git+https://github.com/vpol/text.git --no-deps
pip install git+https://github.com/RasaHQ/rasa-sdk@3.0.2 --no-deps
pip install git+https://github.com/RasaHQ/rasa.git@3.0.4 --no-deps
Once that is finished you should be able to run Rasa!
python -m rasa --version
python -m rasa init
python -m rasa train