Unable to run rasa docker image from docker compose

I have tried with Dockerfile and without it too, neither of this working here he my docker file

FROM rasa/rasa:3.0.8-full

WORKDIR /app

COPY ./formbot /app

USER root

USER 1001

@azizullah2017 can you try to follow this thread and make the necessary changes like the rasa and rasa-sdk versions : Dockerizing my rasa chatbot application that has botfront - #11 by nik202

@nik202 do you what is the issue in above file ?

@azizullah2017 can not comment on that, can be a known bug. I am aware that you opened the issue on rasa Github, mean while trying to use a lower version of the rasa image and see if the issue persists?

@azizullah2017 could you update your issue description. This issue isn’t related to docker-compose. Should be something like Cannot load model, error initializing graph for DIETClassifier.

Thanks,

Greg

I updated the issue.

The problem is related to the release of scipy 1.8.0 on February 5. I worked around the problem by going back to 1.7.3. I think any models trained in an environment with Scipy 1.8.0 will fail when deployed to a production environment.

@stephens thanks for the update.

@DC1991Lau noted in the issue that this is also a problem for 2.x:

It happens with the version 2.8.0 as well:

`File “/opt/venv/lib/python3.8/site-packages/rasa/utils/io.py”, line 81, in pickle_load return pickle.load(f)

ModuleNotFoundError: No module named ‘scipy.sparse._coo’`

may be we are missing something here they have used

FROM rasa/rasa:2.8.0

@azizullah2017 are you able to solve this issue?

nope, I getting error in order version too.

docker run -it --rm --user root -v $(pwd):/app rasa/rasa:2.2.0-full init --no-prompt docker run -it --rm --user root -v $(pwd):/app rasa/rasa:3.0.8-full train --debug

docker-compose up

version: '3.0'

services:
  rasa:
    image: rasa/rasa:2.2.0-full
    user: root
    restart: always
    ports:   
      - 5005:5005  
    volumes:   
      - .:/app  
    command:  
      - run  
      - -m  
      - models   
      - --enable-api  
      - --cors   
      - "*"  
      - --debug

  action_server:
    image: rasa/rasa-sdk:2.2.0
    networks: ['rasa-network']
    ports:
    - "5055:5055"
    volumes:
    - "./formbot/actions:/app/actions"

  duckling:
    image: rasa/duckling:latest
    networks: ['rasa-network']
    ports:
    - "8000:8000"

networks: {rasa-network: {}}

@nik202 do you any idea what i am missing?

rasa_1           | 2022-02-24 13:50:00 DEBUG    rasa.core.lock_store  - Deleted lock for conversation 'default'.
rasa_1           | 2022-02-24 13:50:00 ERROR    rasa.core.channels.rest  - An exception occured while handling user message 'None'.
rasa_1           | Traceback (most recent call last):
rasa_1           |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/channels/rest.py", line 126, in receive
rasa_1           |     metadata=metadata,
rasa_1           |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/channels/channel.py", line 85, in handler
rasa_1           |     await app.agent.handle_message(*args, **kwargs)
rasa_1           |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/agent.py", line 528, in handle_message
rasa_1           |     return await processor.handle_message(message)
rasa_1           |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 87, in handle_message
rasa_1           |     tracker = await self.log_message(message, should_save_tracker=False)
rasa_1           |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 304, in log_message
rasa_1           |     await self._handle_message_with_tracker(message, tracker)
rasa_1           |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 566, in _handle_message_with_tracker
rasa_1           |     parse_data = await self.parse_message(message, tracker)
rasa_1           |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 539, in parse_message
rasa_1           |     if text.startswith(INTENT_MESSAGE_PREFIX):
rasa_1           | AttributeError: 'NoneType' object has no attribute 'startswith'


@azizullah2017 are you using some parser? or can you tell me what is this startwith any code? OR some custom channel?

just init project of rasa.

docker run -it --rm --user root -v $(pwd):/app rasa/rasa:2.2.0-full init --no-prompt

send request http://0.0.0.0:5005/webhooks/rest/webhook

{
  "text": "Hello",
  "message_id": "aziz"
}

@azizullah2017 Ok

Can you try run this please and update me:

docker run --user 1000 -it -v $(pwd):/app rasa/rasa:2.2.0-full init --no-prompt

When you have successfully executed the last command, now run next command to talk to the bot.

docker run --user 1000 -it -v $(pwd):/app rasa/rasa:2.2.0-full shell

what about rest API ?

@azizullah2017 What are you trying to do why you required API? Main post having an issue running docker image?

@azizullah2017 I suggested you the right command only.

@nik202 it is running with shell, i will to use it with rest api.

rasa run --enable --cors "*" 

I need the rest request for production use. the older version of must work, they might be issue with new version of rasa image but it working with older version.

get permission error with --user 1000

docker run --user 1000 -it -v $(pwd):/app rasa/rasa:2.2.0-full init --no-prompt
2022-02-24 15:54:01.577204: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2022-02-24 15:54:07 WARNING  rasa.utils.common  - Failed to write global config. Error: [Errno 13] Permission denied: '/.config'. Skipping.
Welcome to Rasa! 🤖

To get started quickly, an initial project will be created.
If you need some help, check out the documentation at https://rasa.com/docs/rasa.

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/distutils/dir_util.py", line 70, in mkpath
    os.mkdir(head, mode)
PermissionError: [Errno 13] Permission denied: 'tests'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/venv/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/opt/venv/lib/python3.7/site-packages/rasa/__main__.py", line 116, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/opt/venv/lib/python3.7/site-packages/rasa/cli/scaffold.py", line 234, in run
    init_project(args, path)
  File "/opt/venv/lib/python3.7/site-packages/rasa/cli/scaffold.py", line 127, in init_project
    create_initial_project(path)
  File "/opt/venv/lib/python3.7/site-packages/rasa/cli/scaffold.py", line 135, in create_initial_project
    copy_tree(scaffold_path(), path)
  File "/usr/local/lib/python3.7/distutils/dir_util.py", line 159, in copy_tree
    verbose=verbose, dry_run=dry_run))
  File "/usr/local/lib/python3.7/distutils/dir_util.py", line 135, in copy_tree
    mkpath(dst, verbose=verbose)
  File "/usr/local/lib/python3.7/distutils/dir_util.py", line 74, in mkpath
    "could not create '%s': %s" % (head, exc.args[-1]))

Share me action server docker image please.

@azizullah2017 check the relative or absolute path of the “tests” or inspect that all the folder are copied in the docker container or not?

solution:

sudo docker run -it --rm --user 1000 -v $(pwd):/app rasa/rasa:3.0.8-full init --no-prompt

sudo docker run --user 1000 -it -p 5005:5005 -v $(pwd):/app rasa/rasa:3.0.8-full run --enable-api --cors “*”

POST: http://localhost:5005/webhooks/rest/webhook

{
   "message": "Hello",
  "sender": "aziz"
}

response

[
    {
        "recipient_id": "aziz",
        "text": "Hey! How are you?"
    }
]