Hello, I’m using Rasa X with docker and I keep getting an error when training with Spacy’sfrench model.
Here’s the error I have when training:
## Training failed
An unexpected error occurred during training. Error: Please confirm that fr_core_news_md is an available spaCy model. You need to download one upfront. For example:
python -m spacy download en_core_web_md
More informaton can be found on https://rasa.com/docs/rasa/components#spacynlp
Here’s my Dockerfile:
# Extend the official Rasa SDK image
FROM rasa/rasa-sdk:2.8.2
# 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
# Download Spacy models
RUN python3 -m spacy download fr_core_news_md
RUN python3 -m spacy link fr_core_news_md fr
# By best practices, don't run the code with root user
USER 1001
I don’t have a ton of experience with Docker, but it proved to be the easiest method to install Rasa X on my machine. Do I need to rebuild the docker image after adding the download instruction or a simple docker-compose down and docker-compose up is enough? Also, do I extend the right image? I followed the Youtube tutorial to add a custom action server (which works fine) and just added the Spacy’s model instruciton in the Dockerfile, but I wonder if its part of rasa/rasa-sdk or some other image.
I guess you followed rasa-x customized docker-compose installation. If you changed the Dockerfile, run “docker-compose up --build” to rebuild the images before running containers. You can include changes in /etc/rasa/docker-compose.override.yml services definition file.
I did try “docker-compose up --build” without success, but it was a nice reminder of you, it pointed me in the right direction I think. I did rebuild the image with
I’m still getting the same error, but I have seen the spacy model download while rebuilding the Docker. Now I’m pretty sure I might simply not be extending the right image.
Ok, so now I did change my Docker file for the following
# Extend the official Rasa SDK image
FROM rasa/rasa-sdk:2.8.2
# 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 1001
# Extend the official Rasa image
FROM rasa/rasa:main-full
WORKDIR /app
# Change back to root user to install dependencies
USER root
# Download Spacy models
RUN python -m spacy download fr_core_news_md
# By best practices, don't run the code with root user
USER 1001
I can see in the logs while building the image that it download and install the languague package.
Successfully installed fr-core-news-md-3.2.0
✔ Download and installation successful
You can now load the package via spacy.load('fr_core_news_md')
I’m still getting the same error, what am I doing wrong? Is there a way to inspect the running app to see if the package is properly installed?
Ok, so now I realized I was extending two images in the same Docker repo which is probably why it didn’t work. I’m now extending both image independently and create a repository for each of them which actually makes sense.
I now have two Dockerfiles…
“Dockerfile.action” which is the following:
# Extend the official Rasa SDK image
FROM rasa/rasa-sdk:2.8.2
# 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 1001
and “Dockerfile.language” which is the following
# Extend the official Rasa image
FROM rasa/rasa:main-full
WORKDIR /app
# Change back to root user to install dependencies
USER root
# Download Spacy models
RUN python -m spacy download fr_core_news_md
# By best practices, don't run the code with root user
USER 1001
I built and push both on my Docker Hub, great.
Now I’m having some issues about what I should overide in the “docker-compose.override.yml”
I’ve tried those without success:
Finaly, I changed the value of the image in the docker-compose.override.yml as such.