rasa: ModuleNotFoundError: No module named 'actions.actions' when trying to run an action server in a docker container
Rasa Core version: 0.12.4
Python version: 3.6.4
Operating system (windows, osx, …): macOS 10.14.2
Issue: Hi, I’m trying to create a docker image that runs the rasa-core action server. My docker-compose.yml:
version: '3'
services:
action_server:
image: rasa/rasa_core_sdk:latest
volumes:
- ./chat-interface:/app/actions
ports:
- "5055:5055"
Running docker-compose up does get the action server up and running:
INFO:__main__:Action endpoint is up and running. on ('0.0.0.0', 5055)
But I get the following error beforehand:
action_server_1 | INFO:__main__:Starting action endpoint server...
action_server_1 | ERROR:rasa_core_sdk.executor:Failed to register package 'actions.actions'.
action_server_1 | Traceback (most recent call last):
action_server_1 | File "/app/rasa_core_sdk/executor.py", line 144, in register_package
action_server_1 | self._import_submodules(package)
action_server_1 | File "/app/rasa_core_sdk/executor.py", line 131, in _import_submodules
action_server_1 | package = importlib.import_module(package)
action_server_1 | File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
action_server_1 | return _bootstrap._gcd_import(name[level:], package, level)
action_server_1 | File "<frozen importlib._bootstrap>", line 994, in _gcd_import
action_server_1 | File "<frozen importlib._bootstrap>", line 971, in _find_and_load
action_server_1 | File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
action_server_1 | ModuleNotFoundError: No module named 'actions.actions'
action_server_1 | INFO:__main__:Action endpoint is up and running. on ('0.0.0.0', 5055)
I couldn’t figure out what was going wrong so I followed this: https://github.com/RasaHQ/rasa_core/issues/1459#issuecomment-447323161 in another directory, which worked fine
I tried copying the file structure for that example in my own directory as well but I always get the error ‘No module named ‘actions.actions’’ Am I using the wrong syntax in my yml file?
Here is my (simplified) directory structure:
.
├── chat-interface
│ ├── actions.py
│ ├── agent.py
│ ├── domain.yml
│ ├── endpoints.yml
│ ├── helpers.py
│ ├── main.py
│ ├── nlu-config.yml
│ └── trainer.py
├── LICENSE
├── README.md
├── docker-compose.yml
└── requirements.txt
Thanks for any help
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (5 by maintainers)
got it thanks installed blinker, so stupid of me
Hey, I figured out where the error was coming from -
rasa_core_sdkspins up the action server from the main directory and calls the actions files usingactions.actions(/actions/actions.py) but my actions.py has a relativeimport helpersstatement that doesn’t work when being called from the main directory, which doesn’t have a helpers.py file in it. I solved my issue by copying the helpers file into the main directory when creating my docker image.Let’s solve the one issue first before we tackle the second please. Please try it with the following configuration: