SpaCyOSError: [E050] Can't find model 'en' on Heroku platform

Viewed 1414

I am trying to deploy my rasa bot to heroku and i am using python.

My requirements.txt file is like this :

spacy ==2.0.18
https://github.com/explosion/spacy-models/releases/download/en_core_web_md-2.0.0/en_core_web_md-2.0.0.tar.gz#egg=en_core_web_md==2.0.0

Deploying is successful but when i try to run job like this :

web : python -m spacy download en_core_web_md && python my_code.py

or

web : python -m spacy download en && python my_code.py

then I am getting this error :

File "/app/.heroku/python/lib/python3.6/site-packages/spacy/util.py", line 119, in load_model raise IOError(Errors.E050.format(name=name)) OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

what can I do ?

Regards,

zekeriya

1 Answers

I had the same problem at first, but I was finally able to deploy it to Heroku.

You don't need to do "spacy download...", just the following in your Procfile;

web: python my_code.py

You should also have the following in your requirements.txt;

spacy==2.0.18
https://github.com/explosion/spacy-models/releases/download/en_core_web_md-2.0.0/en_core_web_md-2.0.0.tar.gz#egg=en_core_web_md==2.0.0

I also had a runtime.txt file to specify the python version, like this;

python-3.7.2

But I think the most important part is the part where you, in fact, access the spacy api, like this;

import spacy
import en_core_web_md
nlp = en_core_web_md.load()
Related