Spacy nlp = spacy.load("en_core_web_lg")

acodejdatam picture acodejdatam · Jun 6, 2019 · Viewed 12k times · Source

I already have spaCy downloaded, but everytime I try the nlp = spacy.load("en_core_web_lg"), command, I get this error:

OSError: [E050] Can't find model 'en_core_web_lg'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

I already tried

>>> import spacy
>>> nlp = spacy.load("en_core_web_sm")

and this does not work like it would on my personal computer.

My question is how do I work around this? What directory specifically do I need to drop the spacy en model into on my computer so that it is found?

Answer

Ajay Alex picture Ajay Alex · Nov 14, 2019

For a Linux system run the below code in terminal if you would be using a virtual environment else skip first and second command :

python -m venv .env
source .env/bin/activate
pip install -U spacy
python -m spacy download en_core_web_lg

The downloaded language model can be found at :

/usr/local/lib/python3.6/dist-packages/en_core_web_lg -->
/usr/local/lib/python3.6/dist-packages/spacy/data/en_core_web_lg

For more documentation information refer https://spacy.io/usage

Hope it was helpful.