First time installation - 'rasa init' returns ModuleNotFound error

Hi, I want to follow the Rasa Masterclassd, which btw. is an excellent intiative. I unfortunately run into a trouble before i could even start the Masterclass. I followed the detailed installation guide and made a clean installation of homebrew, python and rasa assuming it installed all the latest versions. Installation seemed succesful. When I finally wanted to run ‘rasa init’ I encountered the “ModuleNotFoundError: No module named ‘rasa’” error. What a bummer! Just when the fun was supposed to start. Can anyone help here with trouble shooting? My current explanation is that I am running this on MacOs 10.12.6 which might perhaps not been supported anymore? Thanks for helping out a complete beginner to getting started !

Hi @okk, thanks for checking out our Masterclass! I am sure we can solve your issue :slight_smile:

Do you use any virtual environment? It sounds a bit like you installed in one environment and try to run it in another. E.g. if you use Anaconda, you need to do conda activate yourEnvironment where yourEnvironment is the environment you installed rasa in.

Hi @j.mosig , thanks for the quick reply on what feels like such a noob question. I followed the detailed installation guide on the rasa website. here is what I did:

  1. install homebrew
  2. install python via homebrew
  3. create virtual environment via python3 -m venv --system-site-packages ./venv
  4. activate the virtual environment source ./venv/bin/activate --> in terminal it changes to (venv) MacBook-Pro-2:~ dev$
  5. install rasa pip install rasa-x --extra-index-url
  6. (venv) MacBook-Pro-2:~ dev$ rasa init then gave the ModuleNotFound error. It says in more detail:

File "/Users/dev/venv/bin/rasa", line 6, in <module>
from rasa.__main__ import main
ModuleNotFoundError: No module named 'rasa'

As mentioned before, I am on MacOs 10.12.6. and I noticed that the homebrew installer gave a warning: ==> You are using macOS 10.12. ==> We (and Apple) do not provide support for this old version.

Thanks for any pointers where I could start troubleshooting.

What is the output of pip show rasa in that virtualenv?

The output is:

File "/Users/dev/venv/bin/pip", line 6, in <module>

from pip._internal.main import main

ModuleNotFoundError: No module named 'pip._internal.main'

It is perhaps some file path issue, but this is just an uneducated guess.

Seems to be an issue with pip. Does this help?

Hola, unfortunately I got the same problem. @okk have you already found a solution?

I found the solution for my case. When I was creating the project in PyCharm, the default base interpreter of the virtual environment was python 2.8. But I needed to set it to python3 (version 3.7.4) and afterwards I just installed rasa like in the tutorial and it was working :slight_smile:

  1. pip install rasa-x --extra-index-url
  2. rasa init
1 Like

Hi @StephanieHohenberg , thanks for the tip. I first thought that it might be an issue with my old MacOs, so I created a clean install of MacOS Mojave on another computer and followed the rasa installtion step by step, but I ended up with the same issue, so the installation guide on the rasa homepage definetely needs an update, at least for MacOS and especially for beginners. I downloaded pycharm and set up a project as you described and I get Rasa working. So thanks a lot for your help. I now can follow the Masterclass, which I think is in my case poorly named, I dont have any sense of mastery at this stage. best. oliver

1 Like

Awesome @okk Always glad to help :slight_smile: Happy coding

Just to clarify, I made a fresh install of the latest MacOS Mojave on a brand new hd and then followed the Rasa installation guide, step by step, I still run in the error as described above. Would be great if @Juste or someone else could have a look into the installation guide for MacOS on the Rasa home page. Would be nice if the installation would work out of the box without the need to install pycharm. @StephanieHohenberg do you have any idea how to achieve the same result without pycharm? I believe it must be possible as well with a simple command line?

I’m currently experiencing the same problem. I followed the installation steps exactly and have used virtual environments before yet when I try the init line I get the above error shown above:

File "/Users/dev/venv/bin/rasa", line 6, in <module> from rasa.__main__ import main ModuleNotFoundError: No module named 'rasa'

and when I do the ‘pip show rasa’ command I get no such error message, instead, I have a large description of the package and all of its dependencies and requirements. I’m lost for ideas on what is wrong and it doesn’t matter how many times I uninstall or reinstall anything I get the same errors.

hi, i used the workaround discovered by @StephanieHohenberg You need to install pycharme (the free version) , create a new project, set the location and the interpreter and then do the install from the terminal window in pycharme. see the forum post above with the screenshot for guidance.

Sorry, I just tried it with PyCharm. But I am sure there is a command to change the python version which is used in the virtual environment. Maybe this Stackoverflow post will help you: Use different Python version with virtualenv - Stack Overflow