En_core_web_sm problem

I have this code:

import spacy
import random

nlp = spacy.load("en_core_web_sm")
doc = nlp("Hello, my dog is cute")

for token in doc:
  print(token.text, token.pos_, token.dep_, token.head.text)

And this error:

Traceback (most recent call last):
  File "/home/runner/nlp/main.py", line 4, in <module>
    nlp = spacy.load("en_core_web_sm")
  File "/home/runner/nlp/.pythonlibs/lib/python3.10/site-packages/spacy/__init__.py", line 51, in load
    return util.load_model(
  File "/home/runner/nlp/.pythonlibs/lib/python3.10/site-packages/spacy/util.py", line 472, in load_model
    raise IOError(Errors.E050.format(name=name))
OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a Python package or a valid path to a data directory.

Repl is here.

Basically how do I install en_core_web_sm on Replit?

1 Like
python -m spacy download en_core_web_sm

Didn’t work sadly.
I got this:

/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/bin/python3: No module named pip

then tried rerunning it and it failed with the same error as the OP.

I don’t know, since I ran this on my local machine and it worked fine.

I did this on my Windows PC too so it’s probably a problem that’s got to do with Replit

1 Like