Spacy link error
Asked Answered
U

12

25

When running:

import spacy
nlp = spacy.load('en')

the following is printed:

Warning: no model found for 'en' Only loading the 'en' tokenizer.

/site-packages/spacy/data is empty with the exception of the init file. all filepaths are only pointing to my single installation of python.

Any help appreciated on resolving this.

Thanks! Will

Unchancy answered 17/4, 2017 at 20:56 Comment(1)
Hi Will, if any of the answers here solved your problem, kindly accept it as the answer :)Millford
A
37

I had this same issue when I tried this on Windows 10 - the problem was the output of python -m spacy.en.download all said Linking successful but above that was the message that the symbolic link wasn't actually created, due to permissions.

Running python -m spacy.en.download all as an Adminstrator fixed the problem.

Antagonism answered 3/5, 2017 at 10:57 Comment(3)
Using Ubuntu putting sudo python -m spacy.en.download all solved my issue. Thanks.Kessinger
Syntax changed in the latest version to "python -m spacy download en".Eboni
I'm getting ModuleNotFoundError: No module named 'spacy.gold'Trouveur
S
7

You might need to install the specific module too after installing spacy. Try:

python -m spacy.en.download all

Here is the reference link: https://pypi.python.org/pypi/spacy

Saccharin answered 20/4, 2017 at 3:10 Comment(0)
L
7

run cmd as an administrator ,then download the model en package

python -m spacy download en
Lorilee answered 6/7, 2018 at 5:19 Comment(2)
That helps. if you're using Mac OS, see thisProceeds
nothing worked, but this solved the problem: thanks 🙏Gardol
P
6

If you’ve installed a model via pip, you can also import it directly and then call its load() method:

python -m spacy download en

import spacy
import en_core_web_sm

nlp = en_core_web_.load()
doc = nlp(u'This is a sentence.')
Primitivism answered 9/1, 2018 at 7:50 Comment(1)
This helped me as I dont have admin permissions on work laptop. Thank you.Adoptive
B
3

In my case I had a previous installation of spacy that had created the symlink.

ls -al "/usr/local/lib/python3.5/dist-packages/spacy/data/en"
lrwxrwxrwx 1 root staff 74 Dec  5 00:40 /usr/local/lib/python3.5/dist-packages/spacy/data/en -> /usr/local/lib/python3.5/dist-packages/en_core_web_sm/en_core_web_sm-1.2.0

rm "/usr/local/lib/python3.5/dist-packages/spacy/data/en"

python3 -m spacy download en

And then everything is good.

Boneset answered 31/12, 2017 at 0:6 Comment(0)
I
3

This works for Ubuntu users.

sudo python -m spacy download en
Ideologist answered 27/3, 2018 at 9:57 Comment(0)
M
2

When you use spaCy's download command, it will create shortcut links automatically.

python -m spacy download en

But if you already have downloaded the model, you don't need to download it again, you can create a link using the link command.

python -m spacy download en_core_web_sm
python -m spacy link en_core_web_sm en
Marras answered 19/6, 2020 at 8:42 Comment(0)
B
1

I got around this by simply importing the model instead of performing nlp = spacy.load('en')

Beera answered 21/4, 2017 at 3:37 Comment(1)
Please put this as a comment under question as it seems more like a partial answer at this point.Deceptive
G
0

If python -m spacy download en does not work for you (permissions, etc.), you can download the model first and then pip install it. For example, this is for version 2.3:

https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.0/en_core_web_sm-2.3.0.tar.gz

The .tar.gz archive is the same file that's downloaded during spacy download, and is installable:

pip install /path/to/en_core_web_sm-2.0.0.tar.gz

Then you can do:

import en_core_web_sm

nlp = en_core_web_sm.load()
Gorgonian answered 2/12, 2020 at 17:7 Comment(0)
T
0
  1. Delete the existing one

    pip uninstall spacy 
    
  2. install the spacy

    pip install spacy==2.3.5     
    
  3. Support for Spacy 3 was added. In prior versions of Rasa Open Source, to install spaCy with its language model for the English language, you need to additionally run python3 -m spacy link en_core_web_md en.

    python -m spacy download en_core_web_md 
    
    once symbolic link created for C:\Users\ABC\Anaconda3\envs\RasaBot\lib\site-packages\spacy\data\en <<===>> C:\Users\ABC\Anaconda3\envs\RasaBot\lib\site-packages\en_core_web_md
    ✔ Linking successful
    C:\Users\ABC\Anaconda3\envs\RasaBot\lib\site-packages\en_core_web_md -->
    C:\Users\ABC\Anaconda3\envs\RasaBot\lib\site-packages\spacy\data\en
    You can now load the model via spacy.load('en')
    
Tangier answered 2/11, 2021 at 16:36 Comment(0)
B
-1

In windows user name can be added in "Create symbolic link" in "Local security policy" before downloading en. It is working for me.

Byer answered 23/8, 2017 at 5:18 Comment(0)
B
-2

First you need to train the model. After training, You need to go through a saving and loading process. After that, I hope It'll work. Good Luck. Since they updated the spacy version, find it Here

Barometry answered 1/7, 2017 at 7:50 Comment(1)
No, you don't need to train the default English models that Spacy provides.Boneset

© 2022 - 2024 — McMap. All rights reserved.