i’m using a Rasa X Docker-Compose setup and want to use a custom action for the action_default_ask_affirmation action. I basically want to replace the phrase “Did you mean” for the Two Stage Fallback policy and use a intention mapping.
I used the code from the rasa-demo repo: rasa-demo/actions.py at 3e2bbc7b2615a60a13fb750921bf985b68bc4d29 · RasaHQ/rasa-demo · GitHub
But i’m running into the following problem:
rasa_sdk.endpoint - Starting action endpoint server...
Traceback (most recent call last):
File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
File "/app/rasa_sdk/__main__.py", line 34, in <module>
File "/app/rasa_sdk/__main__.py", line 30, in main
File "/app/rasa_sdk/__main__.py", line 21, in main_from_args
File "/app/rasa_sdk/endpoint.py", line 137, in run
action_package_name, cors_origins=cors_origins, auto_reload=auto_reload
File "/app/rasa_sdk/endpoint.py", line 80, in create_app
File "/app/rasa_sdk/executor.py", line 254, in register_package
File "/app/rasa_sdk/executor.py", line 271, in _register_all_actions
File "/app/rasa_sdk/executor.py", line 165, in register_action
action = action()
File "/app/actions/actions.py", line 21, in __init__
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
The action server can’t find the pandas module. Is there a way to solve this?
You need to build your own action server image and install pandas. The rasa-demo repo has an example Dockerfile that does this and the associated
Your docker-compose then needs to use your image instead of the default action image.
thank you for your reply. I changed my Dockerfile closer to how it is in the rasa-demo repo and added the
I also added a
docker-compose.override.yml file with the following content:
How exactly do I go from here? Do I also have to change something in the
docker-compose.yml? And if I’m building my action server image (via this) do I have to push it to somethin like DockerHub or is this not necessary if I only need this image on that server?
The docker site has an example of building and using your own image here. You can also build and push the image to a docker repo which is what you would typically do in a production environment. There should be lots of docker examples out there on the ways you can do this for your setup.
In most cases this error in Python generally raised:
- You haven’t installed Pandas explicitly with pip install pandas.
- You may have different Python versions on your computer and Pandas is not installed for the particular version you’re using.
You can run the following command in your Linux/MacOS/Windows terminal.
pip install pandas
To be sure you are not having multiple Python versions that are confusing, you should run following commands:
python3 -m pip install pandas
python3 -c 'import pandas'