No module named rasa_sdk when trying to write custom action in actions.py

I’m trying to write a new custom action in actions.py. As the document mentioned, i installed rasa-sdk using

pip3 install rasa-sdk

But when i run my actions.py, it gives me an error named

File “actions.py”, line 34, in from rasa_sdk import Action ImportError: No module named rasa_sdk

So in my code how i imported was like below. (Instead of rasa_sdk i even tried rasa_core_sdk)

from rasa_sdk import Action
from rasa_sdk.events import SlotSet

it seems that it wasn’t installed, do you use the same environment?

@Ghostvv yea, i use python 3.6 with pip3

do these imports work in python shell?

@Ghostvv nope, i tried that, it shows the same error.

it means, it is not installed

i think i found the problem. All these times i’ve used the keyword python instead of python3. My bad. It was a environment issue. Since i used python3 interpreter with pip3 i thought my environment was ok. But i haven’t used python3 keyword before i run my code. My bad. @Ghostvv thanks a lot for the help :slightly_smiling_face:

2 Likes

am facing this issue too ,does new rasa has a problem,mine is saying “unresolved import for all rasa sdk and rasa core” like for all imports,why is that

did you manage to solve this? I’m facing the same issue

hey i m not getting your point. how to solve it

Hi I have the same problem

When in the python shell I run

from rasa_sdk import Action, Tracker

it works

I am running rasa with

python -m rasa interactive

although the error appears in visual studio, not when I run rasa. Maybe it is because VS has a different venv?

Did you manage to solve this issue? I am having the same issue in VS Code.

Hi, I also ran into similar problem, rasa --version Rasa Version : 3.6.0 Minimum Compatible Version: 3.5.0 Rasa SDK Version : 3.6.0 Python Version : 3.8.10 Operating System : Linux-5.15.0-75-generic-x86_64-with-glibc2.29 Python Path : , I created a virtual environment in Ubuntu with python 3.8.10 used for the environment. Any time i have ran the custom actions,py , i ran into the problem. Any help would welcome.