Rasa: Can not build with docker

Created on 3 Jun 2019  路  6Comments  路  Source: RasaHQ/rasa

Rasa version:
1.0.4
Python version:
Tried 3.6 and 3.7
Operating system (windows, osx, ...):
macOS 10.14.5
Issue:

Hey there!

I just followed the Running Rasa with Docker Guide.
In the _Setup_ Section it says I there should be a models directory, after the command docker run -v $(pwd):/app rasa/rasa init --no-prompt did its magic. However, there is no models dir. Further, after the core training is done and it comes to the nlu training, a ModuleNotFoundError is thrown (see traceback below). Looks like spaCy has not been installed.

What am I missing?

Greetings from Bremen
Nick

Error (including full traceback):

Training NLU model...
Traceback (most recent call last):
  File "/usr/local/bin/rasa", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/rasa/__main__.py", line 70, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/usr/local/lib/python3.6/site-packages/rasa/cli/scaffold.py", line 194, in run
    init_project(args, path)
  File "/usr/local/lib/python3.6/site-packages/rasa/cli/scaffold.py", line 112, in init_project
    print_train_or_instructions(args, path)
  File "/usr/local/lib/python3.6/site-packages/rasa/cli/scaffold.py", line 50, in print_train_or_instructions
    args.model = rasa.train(domain, config, training_files, output)
  File "/usr/local/lib/python3.6/site-packages/rasa/train.py", line 48, in train
    kwargs=kwargs,
  File "uvloop/loop.pyx", line 1451, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.6/site-packages/rasa/train.py", line 143, in train_async
    kwargs=kwargs,
  File "/usr/local/lib/python3.6/site-packages/rasa/train.py", line 196, in _do_training
    fixed_model_name=fixed_model_name,
  File "/usr/local/lib/python3.6/site-packages/rasa/train.py", line 391, in _train_nlu_with_validated_data
    config, nlu_data_directory, _train_path, fixed_model_name="nlu"
  File "/usr/local/lib/python3.6/site-packages/rasa/nlu/train.py", line 77, in train
    nlu_config = config.load(nlu_config)
  File "/usr/local/lib/python3.6/site-packages/rasa/nlu/config.py", line 38, in load
    return RasaNLUModelConfig(file_config)
  File "/usr/local/lib/python3.6/site-packages/rasa/nlu/config.py", line 89, in __init__
    from rasa.nlu import registry
  File "/usr/local/lib/python3.6/site-packages/rasa/nlu/registry.py", line 31, in <module>
    from rasa.nlu.utils.spacy_utils import SpacyNLP
  File "/usr/local/lib/python3.6/site-packages/rasa/nlu/utils/spacy_utils.py", line 9, in <module>
    from spacy.language import Language
ModuleNotFoundError: No module named 'spacy'

Command or request that led to error:

docker run -v $(pwd):/app rasa/rasa init --no-prompt
type

Most helpful comment

Just tagged a new 1.0.5 release which should be available once travis finishes building the package.

All 6 comments

hi @fallik - we provide a number of different docker images (of different sizes) for optional dependencies like spaCy.

If you want to use a spaCy based pipeline, you need to use an image tag like rasa/rasa:1.0.4-spacy-en - see the full list here https://hub.docker.com/r/rasa/rasa/tags . You could also use one of the full tags, which has everything installed

@amn41 I think that this bug was introduced 4 days ago (see git blame):

https://github.com/RasaHQ/rasa/blame/master/rasa/nlu/utils/spacy_utils.py#L9

This causes Spacy to become a required dependency for every installation, which is a bug. I'm not using any Spacy components in my pipeline, but now I have to have it installed.

yes that import should probably be scoped. @tmbo can you please double check since tomm is away?

Yes it is, thanks for catching this - I'll fix it and create a patch.

Just tagged a new 1.0.5 release which should be available once travis finishes building the package.

Thank you all guys :)
For the record: I still could not use docker run -v $(pwd):/app rasa/rasa init --no-prompt, I got the same error then. Needed to set the 1.0.6-full tag: docker run -v $(pwd):/app rasa/rasa:1.0.6-full init --no-prompt. Works like a charm now.

Was this page helpful?
0 / 5 - 0 ratings