An Unofficial Guide to Installing Rasa on an M1 Macbook

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
16 Likes

This is great, thanks for writing this up.

Due to this issue, The scipy install should change to this:

  - scipy>=1.4.1,<1.8.0`

Made the change to the file above. Thanks for reporting!

1 Like

I was able to successfully complete the workaround as far as I can tell. However, I’m running into an issue when attempting to start rasa using an existing model (or train a new one).

Could not load model due to dlopen(/Users/abriel/miniforge3/envs/rasa-venv/lib/python3.8/site-packages/tensorflow_text/python/metrics/_text_similarity_metric_ops.so, 0x0006): tried: '/Users/abriel/miniforge3/envs/rasa-venv/lib/python3.8/site-packages/tensorflow_text/python/metrics/_text_similarity_metric_ops.so' (no such file), '/usr/local/lib/_text_similarity_metric_ops.so' (no such file), '/usr/lib/_text_similarity_metric_ops.so' (no such file).
/Users/abriel/miniforge3/envs/rasa-venv/lib/python3.8/site-packages/rasa/shared/utils/io.py:97: UserWarning: The model at 'models' could not be loaded. Error: <class 'tensorflow.python.framework.errors_impl.NotFoundError'>: dlopen(/Users/abriel/miniforge3/envs/rasa-venv/lib/python3.8/site-packages/tensorflow_text/python/metrics/_text_similarity_metric_ops.so, 0x0006): tried: '/Users/abriel/miniforge3/envs/rasa-venv/lib/python3.8/site-packages/tensorflow_text/python/metrics/_text_similarity_metric_ops.so' (no such file), '/usr/local/lib/_text_similarity_metric_ops.so' (no such file), '/usr/lib/_text_similarity_metric_ops.so' (no such file)
/Users/abriel/miniforge3/envs/rasa-venv/lib/python3.8/site-packages/rasa/shared/utils/io.py:97: UserWarning: Agent could not be loaded with the provided configuration. Load default agent without any model.

It seems to complain about tensorflow-text missing. From my own experience this is one of the Rasa dependencies for which no ARM-wheels exist, neither from Pypi, Conda, or any Github repo. It seems though that the ConveRT Featurizer is the only Rasa component that relies on that dependency: rasa/convert_featurizer.py at main · RasaHQ/rasa · GitHub

Do you happen to use it in your model?

1 Like

ConveRTFeaturizer is indeed used in the pipeline.

Hi, when you try to run rasa server with debug flag it is providing following error:
Rasa version: 2.8.9 - 2.8.26
Rasa sdk-version: 2.8.4
Macbook m1 pro 14"

Traceback (most recent call last):
  File "/Users/dishantgandhi/miniforge3/envs/rasaenv/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/Users/dishantgandhi/miniforge3/envs/rasaenv/lib/python3.8/site-packages/rasa/__main__.py", line 118, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/Users/dishantgandhi/miniforge3/envs/rasaenv/lib/python3.8/site-packages/rasa/cli/run.py", line 95, in run
    rasa.run(**vars(args))
  File "/Users/dishantgandhi/miniforge3/envs/rasaenv/lib/python3.8/site-packages/rasa/api.py", line 57, in run
    rasa.core.run.serve_application(
  File "/Users/dishantgandhi/miniforge3/envs/rasaenv/lib/python3.8/site-packages/rasa/core/run.py", line 175, in serve_application
    app = configure_app(
  File "/Users/dishantgandhi/miniforge3/envs/rasaenv/lib/python3.8/site-packages/rasa/core/run.py", line 121, in configure_app
    rasa.core.utils.list_routes(app)
  File "/Users/dishantgandhi/miniforge3/envs/rasaenv/lib/python3.8/site-packages/rasa/core/utils.py", line 110, in list_routes
    for arg in route.parameters:
AttributeError: 'Route' object has no attribute 'parameters'

Hi Vincent,

This is awesome! I followed the guide step-by-step, and training runs smoothly through on my MacBook Max.

Unfortunately, training takes more than 10x longer compared to my old, Intel-based MacBook Pro: 71 instead of 5 minutes.

This is the on my old (Intel) MacBook Pro:

2022-04-05 12:42:38 INFO     rasa.engine.training.hooks  - Starting to train component 'RegexFeaturizer'.
2022-04-05 12:42:38 INFO     rasa.engine.training.hooks  - Finished training component 'RegexFeaturizer'.
2022-04-05 12:42:39 INFO     rasa.engine.training.hooks  - Starting to train component 'LexicalSyntacticFeaturizer'.
2022-04-05 12:42:39 INFO     rasa.engine.training.hooks  - Finished training component 'LexicalSyntacticFeaturizer'.
2022-04-05 12:42:40 INFO     rasa.engine.training.hooks  - Starting to train component 'CountVectorsFeaturizer'.
2022-04-05 12:42:41 INFO     rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer  - 333 vocabulary items were created for text attribute.
2022-04-05 12:42:41 INFO     rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer  - 316 vocabulary items were created for response attribute.
2022-04-05 12:42:41 INFO     rasa.engine.training.hooks  - Finished training component 'CountVectorsFeaturizer'.
2022-04-05 12:42:43 INFO     rasa.engine.training.hooks  - Starting to train component 'CountVectorsFeaturizer'.
2022-04-05 12:42:43 INFO     rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer  - 2327 vocabulary items were created for text attribute.
2022-04-05 12:42:44 INFO     rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer  - 2471 vocabulary items were created for response attribute.
2022-04-05 12:42:44 INFO     rasa.engine.training.hooks  - Finished training component 'CountVectorsFeaturizer'.
2022-04-05 12:42:47 INFO     rasa.engine.training.hooks  - Starting to train component 'DIETClassifier'.
Epochs: 100%|████████████████████████| 100/100 [02:36<00:00,  1.57s/it, t_loss=1, i_acc=0.999, e_f1=1]
2022-04-05 12:45:26 INFO     rasa.engine.training.hooks  - Finished training component 'DIETClassifier'.
2022-04-05 12:45:26 INFO     rasa.engine.training.hooks  - Starting to train component 'EntitySynonymMapper'.
2022-04-05 12:45:28 INFO     rasa.engine.training.hooks  - Finished training component 'EntitySynonymMapper'.
2022-04-05 12:45:28 INFO     rasa.engine.training.hooks  - Starting to train component 'ResponseSelector'.
2022-04-05 12:45:29 INFO     rasa.nlu.selectors.response_selector  - Retrieval intent parameter was left to its default value. This response selector will be trained on training examples combining all retrieval intents.
Epochs: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:25<00:00,  3.92it/s, t_loss=5.08, r_acc=1]
2022-04-05 12:45:56 INFO     rasa.engine.training.hooks  - Finished training component 'ResponseSelector'.
Processed story blocks: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:00<00:00, 1486.89it/s, # trackers=1]
Processed story blocks: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:00<00:00, 70.38it/s, # trackers=35]
Processed story blocks: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:01<00:00, 25.71it/s, # trackers=50]
Processed story blocks: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:01<00:00, 34.05it/s, # trackers=50]
Processed rules: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 1831.46it/s, # trackers=1]
2022-04-05 12:46:00 INFO     rasa.engine.training.hooks  - Starting to train component 'MemoizationPolicy'.
Processed trackers: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:00<00:00, 1496.41it/s, # action=98]
Processed actions: 98it [00:00, 5398.93it/s, # examples=98]
2022-04-05 12:46:01 INFO     rasa.engine.training.hooks  - Finished training component 'MemoizationPolicy'.
2022-04-05 12:46:01 INFO     rasa.engine.training.hooks  - Starting to train component 'RulePolicy'.
Processed trackers: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 1650.65it/s, # action=17]
Processed actions: 17it [00:00, 12649.13it/s, # examples=16]
Processed trackers: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:00<00:00, 1192.05it/s, # action=98]
Processed trackers: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 858.28it/s]
Processed trackers: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 42/42 [00:00<00:00, 748.94it/s]
2022-04-05 12:46:02 INFO     rasa.engine.training.hooks  - Finished training component 'RulePolicy'.
2022-04-05 12:46:02 INFO     rasa.engine.training.hooks  - Starting to train component 'TEDPolicy'.
Processed trackers: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 535/535 [00:00<00:00, 871.08it/s, # action=874]
Epochs: 100%|██████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:35<00:00,  2.78it/s, t_loss=1.19, loss=0.923, acc=1]
2022-04-05 12:46:41 INFO     rasa.engine.training.hooks  - Finished training component 'TEDPolicy'.
2022-04-05 12:46:41 INFO     rasa.engine.training.hooks  - Starting to train component 'UnexpecTEDIntentPolicy'.
2022-04-05 12:46:42 WARNING  rasa.shared.utils.common  - The UnexpecTED Intent Policy is currently experimental and might change or be removed in the future 🔬 Please share your feedback on it in the forum (http://forum.rasa.com) to help us make this feature ready for production.
Processed trackers: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 535/535 [00:00<00:00, 1242.26it/s, # intent=268]
Epochs: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:20<00:00,  4.96it/s, t_loss=0.328, loss=0.233, acc=0.899]
2022-04-05 12:47:03 INFO     rasa.engine.training.hooks  - Finished training component 'UnexpecTEDIntentPolicy'.

→ rasa train 514.40s user 104.70s system 194% cpu 5:17.75 total

And here on my new M1 based McBook Pro:

2022-04-05 12:28:20 INFO     rasa.engine.training.hooks  - Starting to train component 'RegexFeaturizer'.
2022-04-05 12:28:21 INFO     rasa.engine.training.hooks  - Finished training component 'RegexFeaturizer'.
2022-04-05 12:28:21 INFO     rasa.engine.training.hooks  - Starting to train component 'LexicalSyntacticFeaturizer'.
2022-04-05 12:28:21 INFO     rasa.engine.training.hooks  - Finished training component 'LexicalSyntacticFeaturizer'.
2022-04-05 12:28:21 INFO     rasa.engine.training.hooks  - Starting to train component 'CountVectorsFeaturizer'.
2022-04-05 12:28:22 INFO     rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer  - 333 vocabulary items were created for text attribute.
2022-04-05 12:28:22 INFO     rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer  - 316 vocabulary items were created for response attribute.
2022-04-05 12:28:22 INFO     rasa.engine.training.hooks  - Finished training component 'CountVectorsFeaturizer'.
2022-04-05 12:28:22 INFO     rasa.engine.training.hooks  - Starting to train component 'CountVectorsFeaturizer'.
2022-04-05 12:28:22 INFO     rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer  - 2327 vocabulary items were created for text attribute.
2022-04-05 12:28:22 INFO     rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer  - 2471 vocabulary items were created for response attribute.
2022-04-05 12:28:22 INFO     rasa.engine.training.hooks  - Finished training component 'CountVectorsFeaturizer'.
2022-04-05 12:28:24 INFO     rasa.engine.training.hooks  - Starting to train component 'DIETClassifier'.
Metal device set to: Apple M1 Max

systemMemory: 32.00 GB
maxCacheSize: 10.67 GB

Epochs: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [09:41<00:00,  5.82s/it, t_loss=1.03, i_acc=1, e_f1=1]
2022-04-05 12:38:06 INFO     rasa.engine.training.hooks  - Finished training component 'DIETClassifier'.
2022-04-05 12:38:06 INFO     rasa.engine.training.hooks  - Starting to train component 'EntitySynonymMapper'.
2022-04-05 12:38:07 INFO     rasa.engine.training.hooks  - Finished training component 'EntitySynonymMapper'.
2022-04-05 12:38:07 INFO     rasa.engine.training.hooks  - Starting to train component 'ResponseSelector'.
2022-04-05 12:38:08 INFO     rasa.nlu.selectors.response_selector  - Retrieval intent parameter was left to its default value. This response selector will be trained on training examples combining all retrieval intents.
Epochs: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [03:35<00:00,  2.16s/it, t_loss=5.09, r_acc=1]
2022-04-05 12:41:47 INFO     rasa.engine.training.hooks  - Finished training component 'ResponseSelector'.
Processed story blocks: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:00<00:00, 3252.77it/s, # trackers=1]
Processed story blocks: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:00<00:00, 200.69it/s, # trackers=35]
Processed story blocks: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:00<00:00, 59.55it/s, # trackers=50]
Processed story blocks: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:00<00:00, 100.55it/s, # trackers=50]
Processed rules: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 5363.56it/s, # trackers=1]
2022-04-05 12:41:49 INFO     rasa.engine.training.hooks  - Starting to train component 'MemoizationPolicy'.
Processed trackers: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:00<00:00, 5011.46it/s, # action=98]
Processed actions: 98it [00:00, 15560.33it/s, # examples=98]
2022-04-05 12:41:49 INFO     rasa.engine.training.hooks  - Finished training component 'MemoizationPolicy'.
2022-04-05 12:41:49 INFO     rasa.engine.training.hooks  - Starting to train component 'RulePolicy'.
Processed trackers: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 5951.78it/s, # action=17]
Processed actions: 17it [00:00, 43504.07it/s, # examples=16]
Processed trackers: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:00<00:00, 5244.19it/s, # action=98]
Processed trackers: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 3373.56it/s]
Processed trackers: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 42/42 [00:00<00:00, 2661.28it/s]
2022-04-05 12:41:50 INFO     rasa.engine.training.hooks  - Finished training component 'RulePolicy'.
2022-04-05 12:41:50 INFO     rasa.engine.training.hooks  - Starting to train component 'TEDPolicy'.
Processed trackers: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████| 535/535 [00:00<00:00, 4426.25it/s, # action=874]
Epochs: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [39:37<00:00, 23.77s/it, t_loss=0.849, loss=0.558, acc=1]
2022-04-05 13:21:28 INFO     rasa.engine.training.hooks  - Finished training component 'TEDPolicy'.
2022-04-05 13:21:28 INFO     rasa.engine.training.hooks  - Starting to train component 'UnexpecTEDIntentPolicy'.
2022-04-05 13:21:29 WARNING  rasa.shared.utils.common  - The UnexpecTED Intent Policy is currently experimental and might change or be removed in the future 🔬 Please share your feedback on it in the forum (http://forum.rasa.com) to help us make this feature ready for production.
Processed trackers: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████| 535/535 [00:00<00:00, 4869.56it/s, # intent=268]
Epochs: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [16:37<00:00,  9.97s/it, t_loss=0.269, loss=0.169, acc=0.928]
2022-04-05 13:38:19 INFO     rasa.engine.training.hooks  - Finished training component 'UnexpecTEDIntentPolicy'.

→ rasa train 4243.07s user 6242.60s system 246% cpu 1:10:54.90 total

Any idea what I should do differently?

Many thanks,
Markus

1 Like

@mho I’m seeing the same increase in training time on my side. Taking about 140s per iteration on about 10,000 examples.

CPU is at 246%… Not even sure what to make of that! :slight_smile:

1 Like

Its working for me using rasa version 2.8.27

pip install git+https://github.com/RasaHQ/rasa-sdk@2.8.0 --no-deps
pip install git+https://github.com/RasaHQ/rasa@2.8.27 --no-deps

Is working for Rasa X too?

Thanks for the Guide :smiley:

If you comment out tensorflow-metal then the training times become reasonable again. So the M1 GPU seems to be doing more harm than good, which is disappointing.

(And thanks to @khalo-sa for the repo - really helpful for running newer versions)

@benohear - thanks so much!

Now my MacBook Pro M1 Max is c. 2.5x faster than its Intel predecessor (instead of 10x slower).

Thanks for the guide, very helpful indeed.
I use Mac 12.3.1 with an Apple M1 chip, and trying to run one of the examples from Rasa repo.
I get an error on the training phase which relates to Sanic package. Anybody has a clue about the valid packages composition?

Error:

ImportError: cannot import name 'ResponseStream' from 'sanic.response'

The error happens on /rasa/rasa/core/channels/rest.py

Prompt:

? Please enter a path where the project will be created [default: current directory]                       
? Directory '/Users/benmalka/Documents/git/rasa/examples/reminderbot' is not empty. Continue? Yes          
Created project directory at '/Users/benmalka/Documents/git/rasa/examples/reminderbot'.
Finished creating project structure.
? Do you want to train an initial model? 💪🏽 Yes                                                          
Training an initial model...
*Error starts here*

Have also tried to install sanic 21.9.3 and 20.12.3 as well, but environment setup fails on dependency conflict for websockets package.

@ybm11 try this updated YAML file for Rasa 3.1.0

Gerasimos

1 Like

Hi @gerasimos,

Thanks for the suggestion. Seems like it works!

Important Notes:

  • Following your suggestion, I have installed rasa 3.1.0 and rasa-sdk 3.1.1
  • I got the previous error while executing through Pycharm (using the virtual environment, as needed). Much strangely, executing the exact same commands in same conda environment (the one suggested by the thread opener) through Mac terminal does work (Having it working through Mac terminal does not resolve my issue though, as my goal is to have debugging ability).
  • Current setup works in both Pycharm and Mac terminal
1 Like

Thank you @benohear Improved training time after removing the Tensorflow-metal dependency.

Thanks a ton for this guide! Didn’t know it was this tough to setup Rasa on M1 Mac :frowning:

1 Like

How do we install transformers in mac M1?

Hi I am facing issues with the pyscopg2-binary package when installing the dependencies in the conda environment

Collecting psycopg2-binary==2.9.3
  Using cached psycopg2-binary-2.9.3.tar.gz (380 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      running egg_info
      creating /private/var/folders/h4/j57570j90r50ttzbhysb342c0000gn/T/pip-pip-egg-info-blx_uvo9/psycopg2_binary.egg-info
      writing /private/var/folders/h4/j57570j90r50ttzbhysb342c0000gn/T/pip-pip-egg-info-blx_uvo9/psycopg2_binary.egg-info/PKG-INFO
      writing dependency_links to /private/var/folders/h4/j57570j90r50ttzbhysb342c0000gn/T/pip-pip-egg-info-blx_uvo9/psycopg2_binary.egg-info/dependency_links.txt
      writing top-level names to /private/var/folders/h4/j57570j90r50ttzbhysb342c0000gn/T/pip-pip-egg-info-blx_uvo9/psycopg2_binary.egg-info/top_level.txt
      writing manifest file '/private/var/folders/h4/j57570j90r50ttzbhysb342c0000gn/T/pip-pip-egg-info-blx_uvo9/psycopg2_binary.egg-info/SOURCES.txt'
      
      Error: pg_config executable not found.
      
      pg_config is required to build psycopg2 from source.  Please add the directory
      containing pg_config to the $PATH or specify the full executable path with the
      option:
      
          python setup.py build_ext --pg-config /path/to/pg_config build ...
      
      or with the pg_config option in 'setup.cfg'.
      
      If you prefer to avoid building psycopg2 from source, please install the PyPI
      'psycopg2-binary' package instead.
      
      For further information please check the 'doc/src/install.rst' file (also at
      <https://www.psycopg.org/docs/install.html>).
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details

Hi! Sorry for the later response

I made some changes because incompatibility problems with rasa 2.8 I’m sharing my env file. You can download and fallow these steps:

Steps:

conda env create -v --name rasa2-8 -f env_rasa2-8.yml
pip install git+https://github.com/vpol/text.git --no-deps
pip install git+https://github.com/RasaHQ/rasa-sdk@2.8.0 --no-deps
pip install git+https://github.com/RasaHQ/rasa@2.8.27 --no-deps

rasa --version

env_rasa2-8.yml (4.0 KB)

1 Like