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

Marcin Możejko
  • 39,542
  • 10
  • 109
  • 120
negfrequency
  • 1,801
  • 3
  • 18
  • 30

12 Answers12

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.

Nick
  • 1,708
  • 14
  • 18
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

sakshi
  • 71
  • 1
7

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

python -m spacy download en
Bibin Johny
  • 3,157
  • 1
  • 13
  • 16
  • That helps. if you're using Mac OS, see [this](https://stackoverflow.com/questions/38916461/valueerror-unknown-locale-utf-8-when-importing-pandas-in-python-2-7/38917471#38917471) – Itay Sep 16 '18 at 14:36
  • nothing worked, but this solved the problem: thanks – Giuppox Oct 29 '20 at 09:49
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.')
Deepak
  • 1,070
  • 13
  • 10
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.

lucid_dreamer
  • 362
  • 4
  • 9
3

This works for Ubuntu users.

sudo python -m spacy download en
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
louis_guitton
  • 5,105
  • 1
  • 31
  • 33
1

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

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()
Reveille
  • 4,359
  • 3
  • 23
  • 46
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')
    
Dharman
  • 30,962
  • 25
  • 85
  • 135
thrinadhn
  • 1,673
  • 22
  • 32
-1

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

user2550098
  • 163
  • 1
  • 13
-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