Reputation: 891
There are tickets or bugs across the internet on this and because there's Spacy 2.3 and 3.0 I can't tell which is relevant. I'm running 2.3 because moving to 3.0 is like moving to dojo 2.0. All that youtube watching is down the drain. Anyway, the following works:
spacy.load(r'C:\Users\martingale.henrietta\AppData\Local\Continuum\anaconda3\envs\spacy\Lib\site-packages\en_core_web_sm\en_core_web_sm-2.3.1')
or
nlp = en_core_web_sm.load()
But the line that's in every tutorial is -
spacy.load('en_core_web_sm')
or even
spacy.load('en')
if you're really courageous, never works for me. My path includes:
['',
'C:\\Users\\martingale.henrietta\\AppData\\Local\\Continuum\\anaconda3\\envs\\spacy\\python36.zip',
'C:\\Users\\martingale.henrietta\\AppData\\Local\\Continuum\\anaconda3\\envs\\spacy\\DLLs',
'C:\\Users\\martingale.henrietta\\AppData\\Local\\Continuum\\anaconda3\\envs\\spacy\\lib',
'C:\\Users\\martingale.henrietta\\AppData\\Local\\Continuum\\anaconda3\\envs\\spacy',
'C:\\Users\\martingale.henrietta\\AppData\\Local\\Continuum\\anaconda3\\envs\\spacy\\lib\\site-packages',
'C:\\Users\\martingale.henrietta\\AppData\\Local\\Continuum\\anaconda3\\envs\\spacy\\lib\\site-packages\\win32',
'C:\\Users\\martingale.henrietta\\AppData\\Local\\Continuum\\anaconda3\\envs\\spacy\\lib\\site-packages\\win32\\lib',
'C:\\Users\\martingale.henrietta\\AppData\\Local\\Continuum\\anaconda3\\envs\\spacy\\lib\\site-packages\\Pythonwin',
'C:\\Users\\martingale.henrietta\\AppData\\Local\\Continuum\\anaconda3\\envs\\spacy\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\martingale.henrietta\\.ipython',
'C:\\Users\\martingale.henrietta\\OneDrive - 247 Customer Pvt. Ltd\\workspace\\247',
'C:\\Users\\martingale.henrietta\\OneDrive - 247 Customer Pvt. Ltd\\workspace\\247']
And, of course, this is in a Jupyter notebook. How do I get spacy to do spacy.load('en')
in 2.3?
Upvotes: 2
Views: 121
Reputation: 15593
How do I get spacy to do
spacy.load('en')
in 2.3?
You can't. From the docs:
Note that as of spaCy v3.0, shortcut links like
en
that create (potentially brittle) symlinks in your spaCy installation are deprecated. To download and load an installed pipeline package, use its full name:
The shortcuts were based on symlinks, and they always had issues with Windows, or with installing multiple models for the same language, and other things, so they took them out. Except for the argument being longer there's no difference.
This should work just fine:
spacy.load('en_core_web_sm')
If it doesn't work, make sure you actually downloaded the model and post your error.
Upvotes: 1