negfrequency
negfrequency

Reputation: 1897

Spacy link error

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

Upvotes: 25

Views: 29508

Answers (12)

thrinadhn
thrinadhn

Reputation: 2523

  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')
    

Upvotes: 0

Reveille
Reveille

Reputation: 4629

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()

Upvotes: 0

louis_guitton
louis_guitton

Reputation: 5737

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

Upvotes: 2

Bibin Johny
Bibin Johny

Reputation: 3197

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

python -m spacy download en

Upvotes: 7

Shubham Jain
Shubham Jain

Reputation: 31

This works for Ubuntu users.

sudo python -m spacy download en

Upvotes: 3

Deepak
Deepak

Reputation: 1120

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.')

Upvotes: 6

lucid_dreamer
lucid_dreamer

Reputation: 362

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.

Upvotes: 3

user2550098
user2550098

Reputation: 193

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

Upvotes: -1

user4341848
user4341848

Reputation:

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

Upvotes: -2

Nick
Nick

Reputation: 1718

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.

Upvotes: 37

user7899211
user7899211

Reputation: 21

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

Upvotes: 1

sakshi
sakshi

Reputation: 71

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

Upvotes: 7

Related Questions