Lesson 4 - OSError: Can't find model 'en'

Steps performed
pip install spacy
python -m spacy download en
Linking successful
/home/anil/anaconda3/lib/python3.6/site-packages/en_core_web_sm -->
/home/anil/anaconda3/lib/python3.6/site-packages/spacy/data/en

You can now load the model via spacy.load('en')

Error executing code from fastai.nlp import *

When

OSError Traceback (most recent call last)
in ()
11 from fastai.rnn_reg import *
12 from fastai.rnn_train import *
—> 13 from fastai.nlp import *
14 from fastai.lm_rnn import *
15

/mnt/data/ssd000/dsb2017/anil/fastai/courses/dl1/fastai/nlp.py in ()
5 from .dataset import *
6 from .learner import *
----> 7 from .text import *
8 from .lm_rnn import *
9

/mnt/data/ssd000/dsb2017/anil/fastai/courses/dl1/fastai/text.py in ()
9 def sub_br(x): return re_br.sub("\n", x)
10
—> 11 my_tok = spacy.load(‘en’)
12 my_tok.tokenizer.add_special_case(’’, [{ORTH: ‘’}])
13 my_tok.tokenizer.add_special_case(’’, [{ORTH: ‘’}])

~/anaconda3/envs/fastai/lib/python3.6/site-packages/spacy/init.py in load(name, **overrides)
17 “to load. For example:\nnlp = spacy.load(’{}’)”.format(depr_path),
18 ‘error’)
—> 19 return util.load_model(name, **overrides)
20
21

~/anaconda3/envs/fastai/lib/python3.6/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(“Can’t find model ‘%s’” % name)
120
121

OSError: Can’t find model ‘en’

7 Likes

Thanks! It solve my issue when I am using Lesson 5 notebook in ML course

13 Likes

I am also facing same error. But it looks no one else faced this issue except Anil Pandey.

Anil, were you able to resolve this issue?

Here is the complete log of error:


OSError Traceback (most recent call last)
in ()
11 from fastai.rnn_reg import *
12 from fastai.rnn_train import *
—> 13 from fastai.nlp import *
14 from fastai.lm_rnn import *
15

~/fastai/courses/dl1/fastai/nlp.py in ()
5 from .dataset import *
6 from .learner import *
----> 7 from .text import *
8 from .lm_rnn import *
9

~/fastai/courses/dl1/fastai/text.py in ()
9 def sub_br(x): return re_br.sub("\n", x)
10
—> 11 my_tok = spacy.load(‘en’)
12 my_tok.tokenizer.add_special_case(’’, [{ORTH: ‘’}])
13 my_tok.tokenizer.add_special_case(’’, [{ORTH: ‘’}])

~/anaconda3/envs/fastai/lib/python3.6/site-packages/spacy/init.py in load(name, **overrides)
17 “to load. For example:\nnlp = spacy.load(’{}’)”.format(depr_path),
18 ‘error’)
—> 19 return util.load_model(name, **overrides)
20
21

~/anaconda3/envs/fastai/lib/python3.6/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(“Can’t find model ‘%s’” % name)
120
121

OSError: Can’t find model ‘en’

Abhishek

Following step resolved the issue

source activate fastai
then install
pip install spacy
python -m spacy download en

4 Likes

thanks Anil. I am able to compile now. Below command resolved the issue

python -m spacy download en

1 Like

Thanks. Is there a way to ensure this goes into the machine setup so folks don’t have to do this step manually?

1 Like

there is a bit different if you are window user here.

  1. Find anaconda prompt and run as administrator
  2. activate fastai environment by typing ‘activate fastai’
  3. python -m spacy download en

This worked for me. I don’t know why but the source command only worked from the command line and not from the notebook using ![quote=“pandeyaah, post:5, topic:11252, full:true”]
Abhishek

Following step resolved the issue

source activate fastai
then install
pip install spacy
python -m spacy download en
[/quote]

1 Like