Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to load English language module of spacy with spacy.load('en')

I am not able to load the English model in jupyter notebook with below code-

!pip install spacy
import spacy
spacy.load('en')

Error message:

OSError Traceback (most recent call last) in () ----> 1 spacy.load('en')

C:\ProgramData\Anaconda3\lib\site-packages\spacy_init_.py in load(name, **overrides) 19 if depr_path not in (True, False, None): 20 deprecation_warning(Warnings.W001.format(path=depr_path)) ---> 21 return util.load_model(name, **overrides) 22 23

C:\ProgramData\Anaconda3\lib\site-packages\spacy\util.py in load_model(name, **overrides) 117 elif hasattr(name, 'exists'): # Path or Path-like to model data 118 return load_model_from_path(name, **overrides) --> 119 raise IOError(Errors.E050.format(name=name)) 120 121

OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

I have installed python version 2.7.15, 3.6.7, 3.7.1 and Anaconda3 5.3.1

I have downloaded the spacy package with

!pip install spacy

and English package with

python -m spacy download en

in anaconda prompt

like image 797
sanjay saini Avatar asked Dec 24 '18 09:12

sanjay saini


People also ask

What does “import error – no module named Spacy” mean?

Import Error: No module named spacy This error means that the spaCy module can’t be located on your system, or in your environment. Make sure you have spaCy installed.

How to install the English model in Spacy?

To install the English model in Spacy, following have been tried: In cmd 1. python -m spacy download en 2. python -m spacy.en.download -- force all Thanks for the report – this looks like the same issue as #909 (closing this issue to keep the discussion in one place).

How to load models into Spacy/data?

You can also copy the model data into spacy/data, or manually create a symlink in that directory. This will allow you to also load models via spacy.load ('name_of_directory_or_symlink'). ines added the windows label on Mar 24, 2017 This thread has been automatically locked since there has not been any recent activity after it was closed.

Why can't I download [Lang] for my Spacy version?

No compatible package found for [lang] (spaCy vX.X.X). This usually means that the trained pipeline you’re trying to download does not exist, or isn’t available for your version of spaCy. Check the compatibility table to see which packages are available for your spaCy version.


2 Answers

Edit: Based on your comments it seems you downloaded the model but couldn't link it. You do not have permission to do it, check here and give permission to current user. After that download model with same script:

python -m spacy download en

Check here, there is a brief description of the error.

like image 78
mcemilg Avatar answered Sep 21 '22 00:09

mcemilg


I installed Spyder and anoconda which allowed me to run spacy but only in Spyder. Try that to see if you can run from there.

Update

Try using the following instead

pip install -U spacy
python -m spacy download en

The use this in your code:

import spacy
nlp = spacy.load('en')
like image 28
Gabriel Wolf Avatar answered Sep 20 '22 00:09

Gabriel Wolf