Skip to content Skip to sidebar Skip to footer

How To Add A Spacy Model To A Requirements.txt File?

I have an app that uses the Spacy model 'en_core_web_sm'. I have tested the app on my local machine and it works fine. However when I deploy it to Heroku, it gives me this error: '

Solution 1:

Add this in your deployment step, if using docker add in Dockerfile

pip3 install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.5/en_core_web_sm-2.2.5.tar.gz --user

EDIT

Add

spacy>=2.2.0,<3.0.0 https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz#egg=en_core_web_sm

in requirements.txt

Spacy Doc Refer Downloading and requiring model dependencies section

For more detail on how to add github-sourcesee this and follow YPCrumble answer

Solution 2:

Ok, so after some more Googling and hunting for a solution, I found this solution that worked:

I downloaded the tarball from the url that @tausif shared in his answer, to my local system.

Saved it in the directory which had my requirements.txt file.

Then I added this line to my requirements.txt file: ./en_core_web_sm-2.2.5.tar.gz

Proceeded with deploying to Heroku - it succeeded and the app works perfectly now.

Solution 3:

For en-core-web-sm == 3.0.0, this worked for me.

Replace the line "en-core-web-sm==3.0.0" with

en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0-py3-none-any.whl

Post a Comment for "How To Add A Spacy Model To A Requirements.txt File?"