Yes, I have looked all similar cases here in forum and also network search but still not working.
I followed this instructions
https://rasa.com/docs/rasa/how-to-deploy#building-an-action-server-image
Here is my Docker file
# Extend the official Rasa SDK image
FROM rasa/rasa-sdk:2.2.0
#COPY * /app/
# Use subdirectory as working directory
WORKDIR /app
# Copy any additional custom requirements, if necessary (uncomment next line)
# COPY actions/requirements-actions.txt ./
# Change back to root user to install dependencies
USER root
# Install extra requirements for actions code, if necessary (uncomment next line)
# RUN pip install -r requirements-actions.txt
# Copy actions folder to working directory
COPY ./actions /app/actions
# By best practices, don't run the code with root user
USER 1003
Command I give create docker image
docker build . -t rasa-sdk:2.2.0
No errors
but when I try start my action server with this command
docker run -v $(pwd)/actions:/app/actions --net action-link --name action-server-prod rasa/rasa-sdk:2.2.0
I get this error
2021-06-03 12:28:17 INFO rasa_sdk.endpoint - Starting action endpoint server...
2021-06-03 12:28:17 ERROR rasa_sdk.executor - Failed to register package 'actions'.
Traceback (most recent call last):
File "/app/rasa_sdk/executor.py", line 254, in register_package
self._import_submodules(package)
File "/app/rasa_sdk/executor.py", line 217, in _import_submodules
self._import_module(full_name)
File "/app/rasa_sdk/executor.py", line 231, in _import_module
module = importlib.import_module(name)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/actions/actions.py", line 5, in <module>
from rasa_sdk.types import DomainDict
File "/app/rasa_sdk/types.py", line 3, in <module>
from typing_extensions import TypedDict
Here is my directory
total 44
drwxrwxr-x 6 paulii paulii 4096 Jun 3 12:27 ./
drwxrwxr-x 12 paulii paulii 4096 Jun 3 07:19 ../
-rw-rw-r-- 1 paulii paulii 581 Jun 3 12:27 Dockerfile
drwxr-xr-x 3 paulii root 4096 Jun 3 09:02 actions/
-rw-r--r-- 1 paulii root 404 Jun 3 09:04 config.yml
-rw-r--r-- 1 paulii root 980 Dec 17 09:29 credentials.yml
drwxr-xr-x 2 paulii root 4096 Jun 3 09:01 data/
-rw-r--r-- 1 paulii root 1036 Jun 3 08:55 domain.yml
-rw-r--r-- 1 paulii root 1418 Jun 3 09:31 endpoints.yml
drwxr-xr-x 2 paulii root 4096 Jun 3 09:06 models/
drwxr-xr-x 2 paulii root 4096 May 25 09:33 tests/
total 16
drwxr-xr-x 3 paulii root 4096 Jun 3 09:02 ./
drwxrwxr-x 6 paulii paulii 4096 Jun 3 12:27 ../
-rw-r--r-- 1 paulii root 0 Dec 17 09:29 __init__.py
drwxr-xr-x 2 paulii root 4096 Jun 3 10:15 __pycache__/
-rw-r--r-- 1 paulii root 1497 Jun 3 09:02 actions.py
Here is my docker network
NETWORK ID NAME DRIVER SCOPE
7a60d1a331b2 action-link bridge local
58401e5526ef bridge bridge local
c1cdaa045b04 host host local
1cf75b170a7d none null local
and action.py
from typing import Text, List, Any, Dict
from rasa_sdk import Tracker, FormValidationAction
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.types import DomainDict
class ValidateNameForm(FormValidationAction):
def name(self) -> Text:
return "validate_name_form"
def validate_first_name(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate `first_name` value."""
# If the name is super short, it might be wrong.
print(f"First name given = {slot_value} length = {len(slot_value)}")
if len(slot_value) <= 2:
dispatcher.utter_message(text=f"That's a very short name. I'm assuming you mis-spelled.")
return {"first_name": None}
else:
return {"first_name": slot_value}
def validate_last_name(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate `last_name` value."""
# If the name is super short, it might be wrong.
print(f"Last name given = {slot_value} length = {len(slot_value)}")
if len(slot_value) <= 2:
dispatcher.utter_message(text=f"That's a very short name. I'm assuming you mis-spelled.")
return {"last_name": None}
else:
return {"last_name": slot_value}
Updated information
- I installed rasa-sdk:2.2.0 in my Ubuntu sandbox (Virtualbox) and FIRST time it installed BUT not SECOND time, same error as here
- Then I tried rasa-sdk:2.6.0 and that installed correctly, no errors. Tiried second time and also Ok
So something wrong in 2.2.0?! I use Rasa 2.2.0 because socketio is not working in higher versions.