Docker container not downloading Spacy non-english models

Question:

I already have a docker image built with spacy and other dependencies installed. I am trying to build another image using docker build, pulling from the existing image, which will contain non-english spacy modules. I am using Docker desktop to do this. This is my docker file:

FROM docker/image:14jul2020
ENV http_proxy="http://internet.com:83"
ENV https_proxy="http://internet.com:83"

# spacy
RUN pip install spacy
RUN python -m spacy de_dep_news_trf
RUN python -m spacy pt_core_news_sm

However, this code gives me an error only when it starts downloading the non-english modules.

Step 6/10 : RUN python -m spacy de_dep_news_trf
 ---> Running in b6de3cbe0490

    Unknown command: de_dep_news_trf
    Available: download, link, info, train, evaluate, convert, package,
    vocab, init-model, profile, validate

The command '/bin/sh -c python -m spacy de_dep_news_trf' returned a non-zero code: 1

Is there some other command i should be using to download these dependencies? DO i need any particular version support? I am just unable to figure out what i am doing wrong here. Any pointers is much appreciated.

Asked By: M PAUL

||

Answers:

Unknown command: de_dep_news_trf
Available: download, link, info, train, evaluate, convert, package,
vocab, init-model, profile, validate

The error already told where is wrong, your command should be:

python -m spacy download de_dep_news_trf

See help:

# python -m spacy --help
Usage: python -m spacy [OPTIONS] COMMAND [ARGS]...

  spaCy Command-line Interface

  DOCS: https://spacy.io/api/cli

Options:
  --install-completion [bash|zsh|fish|powershell|pwsh]
                                  Install completion for the specified shell.
  --show-completion [bash|zsh|fish|powershell|pwsh]
                                  Show completion for the specified shell, to
                                  copy it or customize the installation.

  --help                          Show this message and exit.

Commands:
  convert   Convert files into json or DocBin format for training.
  debug     Suite of helpful commands for debugging and profiling.
  download  Download compatible trained pipeline from the default download...
  evaluate  Evaluate a trained pipeline.
  info      Print info about spaCy installation.
  init      Commands for initializing configs and pipeline packages.
  package   Generate an installable Python package for a pipeline.
  pretrain  Pre-train the 'token-to-vector' (tok2vec) layer of pipeline...
  project   Command-line interface for spaCy projects and templates.
  train     Train or update a spaCy pipeline.
  validate  Validate the currently installed pipeline packages and spaCy...
Answered By: atline
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.