No module named 'en_core_web_sm'

I am deploying an app using streamlit share and getting this error. The code is working fine on my local but getting error on deployment. The requirement file is update and has an entry as
en_core_web_sm==2.2.0

image

This is the piece of code where I can getting error.
image

Is there any workaround to get rid of this issue?

Thanks

Hello @tech,

I’ve tried pip install en_core_web_sm but if fails, this does not seem like this package is available on Pypi, so I assume it wouldn’t do anything inside the requirements.txt file :confused:. Or maybe it’s a private package on another private Pypi server ?

This en_core_web_sm though does look like a Spacy model. So maybe this would do as a workaround:

  1. Install spacy, by putting it in the requirements.txt file.
  2. Load en_core_web_sm through Spacy:
import spacy
nlp = spacy.load("en_core_web_sm")

Best,
Fanilo

The documentation says you need to:

python -m spacy download en_core_web_sm

Alternatively, you can install from the URL (which you should be able to include into a requirements.txt file):

pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz
1 Like

I tried all the possible combinations but it is not working.

I am now trying to run a separate script from spacy streamlit documentation page but still getting the same error.

Here is the link for the app.
https://share.streamlit.io/techblogp/testapp/main/app.py

and I have taken the code from here https://github.com/explosion/spacy-streamlit/blob/master/examples/01_out-of-the-box.py

I have wasted so much time on this. I really appreciate any pointer.

Tried this, didn’t work!

Looks like this works on the requirements.txt

en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz

5 Likes

This worked!

2 Likes

hey! Can i know how should i solve this? I’m facing the same error and not quite sure how to fix it with this link. please and thank you :slight_smile:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.