PyCharm can't find Spacy Model 'en'
I don't know if it is still relevant, but I run into it too. The module was loaded well on Jupyter Notebook but not in my PyCharm. To solve it go to the interpreter of your project in PyCharm (using ctrl + alt + s). See the full path to the interpreter you are using. Then use it the terminal in such a way:
FULL_PATH_TO_PYTHON_INTERPRTER -m spacy download en
It should work now from your PyCharm.
Spacy explains several ways to download a model : https://spacy.io/usage/models#download
Using python -m
# Download best-matching version of specific model for your spaCy installation
python -m spacy download en_core_web_sm
# Out-of-the-box: download best-matching default model and create shortcut link
python -m spacy download en
# Download exact model version (doesn't create shortcut link)
python -m spacy download en_core_web_sm-2.2.0 --direct
Using pip
# With external URL
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
# With local file
pip install /Users/you/en_core_web_sm-2.2.0.tar.gz
Using manual download
https://spacy.io/usage/models#download-manual
Now how to download it using PyCharm ?
I tried to do it by installing an URL package Project Interpreter in a virtual environment (venv) :
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.5/en_core_web_sm-2.2.5.tar.gz
But Pycharm failed to install the tar directly.
Solution :
Finally I just add the github URL of the tar in the requirements.txt
, then PyCharm will install it for you.
Add this below in requirements.txt :
# spacy
spacy
# spacy model
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.5/en_core_web_sm-2.2.5.tar.gz
You can do it for all the models on the github release page : https://github.com/explosion/spacy-models/releases/
Actually this is what happens when you download a new spacy model, as indicated in the Spacy :
The download command will install the model via pip, place the package in your site-packages directory and create a shortcut link that lets you load the model by a custom name. The shortcut link will be the same as the model name used in spacy download.
It seems that you are installing at the system level, so try running it as "Run as Admin" or you can also try the virtualenv option. Ignore the successfull linking message, as it's just a shortcut.
You can also refer this for detailed troubleshooting guide.