Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dldisha opened this issue Dec 3, 2019 · 4 comments
Labels
install Installation issues

Comments

@dldisha
Copy link

dldisha commented Dec 3, 2019

I have installed spacy and downloaded en_core_web_sm with:

pip3 install spacy
python3 -m spacy download en_core_web_sm

When I try to run the en_core_web_sm module in Python IDE with:

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

it shows an error message:

 File "/home/disha/Desktop/project/python/parser/venv/lib/python3.6/site-packages/spacy/__init__.py", line 30, in load
    return util.load_model(name, **overrides)
  File "/home/disha/Desktop/project/python/parser/venv/lib/python3.6/site-packages/spacy/util.py", line 169, in load_model
    raise IOError(Errors.E050.format(name=name))
OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

I have tried every possible solution which was suggested on GitHub and Stack Overflow but nothing worked

  • Operating System: Ubuntu
  • Python Version Used: 3.6
  • spaCy Version Used: 2.2.3

Can somebody help me fix this issue? Thanks in advance!

@adrianeboyd adrianeboyd added the install Installation issues label Dec 4, 2019
@adrianeboyd
Copy link
Contributor

Hi, check that the python3 command you are using to install spacy and the model is the same python command as used within the IDE. I can't tell for sure, but I would guess that python3 is the system python from /usr/bin/python3 and the IDE is using python in your venv, maybe: /home/disha/Desktop/project/python/parser/venv/bin/python.

Also, the error message makes it look like you were trying to run spacy.load('en') instead of spacy.load('en_core_web_sm'). If you run spacy download en_core_web_sm, the shortcut en isn't created, so you need to use spacy.load('en_core_web_sm').

You can add the shortcut with spacy link en_core_web_sm en or have it created along with the download with spacy download en, but honestly it's a good idea to use the full name to avoid confusion.

@dldisha
Copy link
Author

dldisha commented Dec 4, 2019

Yeah, this solved my issue. Python3 and IDE were using different versions and directories. Therefore, it wasn't able to load the model.

To solve this, I copied en_core_web_sm model directories in the project directory itself i.e in:
/parser/venv/lib/python3.6/site-packages

Thanks :)

@adrianeboyd
Copy link
Contributor

Glad it's working! It would be better to install with pip within the venv than to copy the directory:

source /home/disha/Desktop/project/python/parser/venv/bin/activate
pip install -U spacy
spacy download en_core_web_sm

@lock
Copy link

lock bot commented Jan 3, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
install Installation issues
Projects
None yet
Development

No branches or pull requests

2 participants