Training NLU french Model in Docker

Hello community ,

I’m trying to train NLU RASA Model in a docker image but i got this Error message

I’ve been already installed all requirements and I also installed spacy french model .

Hi :slight_smile:

How did you install the dependencies ? Via a Dockerfile at the image generation ? In command line inside the container ?

Hello @GuillaumeKoenigTncy, You should create a dockerfile first related to your rasa image , Inside this file you can write RUN followed by the command that allows you to install all dependencies .

I know :slight_smile: I use docker and RASA every day ^^

My docker file looks like that

# Extend the official Rasa SDK image
FROM rasa/rasa:1.4.3-full

USER root

# Add a custom system library
RUN apt-get update && \
    apt-get install -y git && \
    apt-get install -y nano && \
    apt-get install -y make

ADD . /app
RUN pip install -r requirements.txt

RUN python -m spacy download <A SPACY MODEL>
RUN python -m spacy link <A SPACY MODEL> <AN ALIAS>

RUN python -m nltk.downloader <A NLTK LIB>

COPY --from=intermediate models/ models/

Could you share yours ?

1 Like

My docker file is

FROM rasa/rasa:latest-full USER root COPY requirements.txt /tmp/ RUN pip install -r /tmp/requirements.txt

The only difference I see here is the use of COPY instead of my ADD. Normally they are the same for Docker.

You are using the full latest version of RASA. If I remember good the full version include Spacy (and other decencies like Mitie and others) directly so you don’t need to install it yourself.

I use the full version of RASA 1.4.3 and never install Spacy myself.

So maybe investigate here…

I wish that i give enough information . Good Luck

Good luck to you ^^ for me it works :slight_smile:

@GuillaumeKoenigTncy I also extended the Rasa image to install a nltk library. However the worker still can not seem to find it…

   Resource vader_lexicon not found.
  Please use the NLTK Downloader to obtain the resource:

  >>> import nltk

  For more information see:

  Attempted to load sentiment/

  Searched in:
    - '/nltk_data'
    - '/opt/venv/nltk_data'
    - '/opt/venv/share/nltk_data'
    - '/opt/venv/lib/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'
    - ''

This is what my dockerfile looks like:

# Extend the official Rasa SDK image
FROM rasa/rasa:latest-full

USER root

# Use subdirectory as working directory

# Copy any additional custom requirements, if necessary (uncomment next line)
COPY requirements.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.txt
RUN python -m nltk.downloader vader_lexicon
# Copy sentiment analyzer to working directory
COPY /app

CMD ["start","--actions","actions"]

# By best practices, don't run the code with root user
USER 1001

# add as environment variable

Any Idea?

Any updates on this issue?