Build container Docker rasa/rasa with variant in Spanish

Hi! I am trying to build with docker container that contains the Spanish variant of spacy. For this, it occurred to me to create a dockerfile with the following information:

FROM rasa/rasa:1.10.12-spacy-en
RUN python -m spacy download es_core_news_md && \
    python -m spacy link es_core_news_md es

And a docker-compose with the following:

version: '3.3'
services:
  umbot:
    build: .
    volumes:
      - 'data:/var/www/html/docker/volumen'
    ports:
      - '5013:5013'
    expose:
      - 5013
    command:
      - init
volumes:
  data: {}

But I get the following error:

root@umsa-SWF-0:/var/www/html/docker/imagen# docker-compose up -d --build
Building umbot
Step 1/2 : FROM rasa/rasa:1.10.12-spacy-en
 ---> ae11d7c757d8
Step 2/2 : RUN python -m spacy download es_core_news_md &&     python -m spacy link es_core_news_md es
 ---> Running in 3e7288dbf279
Collecting es_core_news_md==2.1.0
  Downloading https://github.com/explosion/spacy-models/releases/download/es_core_news_md-2.1.0/es_core_news_md-2.1.0.tar.gz (73.4MB)
Building wheels for collected packages: es-core-news-md
  Building wheel for es-core-news-md (setup.py): started
  Building wheel for es-core-news-md (setup.py): finished with status 'done'
  Created wheel for es-core-news-md: filename=es_core_news_md-2.1.0-cp37-none-any.whl size=74602272 sha256=ad969f41171e82653fa4b3d9d8f9db0bd97810c8c14d97b8ea77363fb0827e17
  Stored in directory: /tmp/pip-ephem-wheel-cache-65b4g2w1/wheels/20/f7/6b/7a1ba56f009b05386d123ea088b56635594a046acd5cfdd2a2
Successfully built es-core-news-md
Installing collected packages: es-core-news-md
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/opt/venv/lib/python3.7/site-packages/es_core_news_md-2.1.0.dist-info'
Consider using the `--user` option or check the permissions.

WARNING: You are using pip version 19.3.1; however, version 20.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ERROR: Service 'umbot' failed to build: The command '/bin/bash -o pipefail -c python -m spacy download es_core_news_md &&     python -m spacy link es_core_news_md es' returned a non-zero code: 1

Could you help me? I am very lost with the docker world :dizzy_face:

Hey @matias18233 I think You are trying to install the package to a system folder which you don’t have permissions, have you tried using

sudo docker-compose up -d --build Building umbot instead ?

1 Like

Hi @jusce17!

Thank you very much for your answer. I made the modification you suggested but I still have the same problem :disappointed_relieved:

I managed to get it working! I had to add ** USER root ** in my dockerfile as it was running under the wrong user: ** USER 1001 **, which came from rasa’s dockerfile.

I share the full dockerfile in case someone runs into the same problem in the future:

FROM rasa/rasa:1.10.12-spacy-en
USER root
RUN python -m spacy download es_core_news_md && \
    python -m spacy link es_core_news_md es

Thank you @jusce17