Error in docker run | "rasa.core.agent - Could not load model due to unsupported operand type(s) for +=: 'NoneType' and 'int'"

Hi,

I am trying to build a RASA (build from source) NLU in a base Python image, sharing Dockerfile snippets below:

FROM python:3.8

RUN mkdir -p /app/nlu
WORKDIR /app/nlu

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN apt-get update \
    && apt-get install -y curl git

# Install poetry & RASA from source
RUN python3 -m pip install --upgrade pip \
    && pip3 install poetry \
    && git clone https://github.com/RasaHQ/rasa.git \
    && cd rasa \
    && poetry install

# Install dependencies:
COPY . .
RUN pip3 install -r requirements.txt
RUN python3 -m spacy download en_core_web_sm

EXPOSE 5005

RUN rasa telemetry disable
CMD ["rasa", "run"]

During docker build there are no issues. Whereas, while doing docker run, I get the model not loading problem.

2021-07-30 17:04:56 INFO     root  - Starting Rasa server on http://localhost:5005
2021-07-30 17:04:56 INFO     rasa.model  - Loading model models/20210730-194259.tar.gz...
2021-07-30 17:04:57 ERROR    rasa.core.agent  - Could not load model due to unsupported operand type(s) for +=: 'NoneType' and 'int'.
/app/nlu/rasa/rasa/shared/utils/io.py:97: UserWarning: The model at 'models' could not be loaded. Error: <class 'TypeError'>: unsupported operand type(s) for +=: 'NoneType' and 'int'
/app/nlu/rasa/rasa/shared/utils/io.py:97: UserWarning: Agent could not be loaded with the provided configuration. Load default agent without any model.
2021-07-30 17:04:57 INFO     root  - Rasa server is up and running.

@mriganktiwari

COPY . .

Are you sure this is the right syntax to copy from PWD to the image? Just checking

@mriganktiwari

FROM python:3.8-slim-buster

Do check the python image also from docker hub.

@mriganktiwari Do you have a rasa project ready? Or its a base rasa project?

  1. Yes it is correct, otherwise it would have thrown an error like:
models/ dir not found
  1. When I try install RASA from source and then try rasa run, it works fine. Its only docker that gives issue.

  2. python:3.8-slim-buster is from docker hub

  3. yes, the project is ready

@mriganktiwari I know you have your own Dockerfile snippet code, but do ref this thread may be it help you or give you some idea , I just see; so thought to ref you Socket.io dont work when using Docker

Thank you!

But i was able to solve it earlier with just a fresh start again.

@mriganktiwari No worries, If you got time do share the brief solution for others. Good Luck!

I did not changes anywhere, I felt my setup was too messed up so I started fresh, and it just worked.

Wish there was something more insightful to share.

ok, good to know, good luck!