Shivi Bhatia
Shivi Bhatia

Reputation: 189

Cant Locate Spacy French Model

I am loading Spacy French Model from Spacy Website and still not able to run it.

Have looked at the similar scenarios StackOverFlow and GitHub

The package is successfully installed via pip as below and the other codes.

python -m spacy download fr_core_news_sm

from spacy.lang.fr.examples import sentences 
import fr_core_news_sm

nlp = spacy.load('fr_core_news_sm')
doc = nlp(sentences[0])
print(doc.text)
for token in doc:
print(token.text, token.pos_, token.dep_)    

I get the error as below:
[E050] Can't find model 'fr_core_news_sm'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory

Upvotes: 1

Views: 2252

Answers (1)

Eric McLachlan
Eric McLachlan

Reputation: 3530

I wonder if you have two versions of python installed?

If this were the case, you could be running one version of Python (say, Python 3.6) when calling

python -m spacy download fr_core_news_sm

Then, when you start your program, you might be running another version (say, Python 3.7). In this case, since the file hasn't been downloaded for python 3.7, you may get the error you are seeing.

You can check what is the default version of Python via the command line using:

python --version

If your application is being run on Python 3.7., you can download specifically to Python 3.7 by running:

python3.7 -m spacy download fr_core_news_sm

I hope this helps.

Upvotes: 3

Related Questions