Spacy: Problem with spacy.load('en')

Created on 13 Dec 2017  Â·  14Comments  Â·  Source: explosion/spaCy

I have some related issues, I download the 'en' model,
$ python3 -m spacy download en $, yield
Linking sucessful
/home/abc/miniconda3/lib/python3.6/site-packages/en_core_web_sm -->
/home/abc/miniconda3/lib/python3.6/site-packages/spacy/data/en

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

However, when I use it
$nlp=spacy.load('en')$
I still get the information "OSError: Can't find model 'en'"

install models windows

Most helpful comment

Try this....
pip install spacy && python -m spacy download en

This worked for me.

All 14 comments

Please try to install this and see
conda install spacy
python -m spacy.en.download
python -c "import spacy; spacy.load('en')"

Looks like this is the same issue as #1761, so merging both to keep everything in one place. I also just submitted a fix that will hopefully solve the underlying problem – see #1792.

Try this....
pip install spacy && python -m spacy download en

This worked for me.

I have installed with Python3, if I try to run python3 -m spacy download en I get this error:

raceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/usr/local/lib/python3.6/site-packages/spacy/__init__.py", line 4, in <module>
    from .cli.info import info as cli_info
  File "/usr/local/lib/python3.6/site-packages/spacy/cli/__init__.py", line 1, in <module>
    from .download import download
  File "/usr/local/lib/python3.6/site-packages/spacy/cli/download.py", line 10, in <module>
    from .link import link
  File "/usr/local/lib/python3.6/site-packages/spacy/cli/link.py", line 8, in <module>
    from ..util import prints
  File "/usr/local/lib/python3.6/site-packages/spacy/util.py", line 8, in <module>
    import regex as re
  File "/usr/local/lib/python3.6/site-packages/regex.py", line 683, in <module>
    _pattern_type = type(_compile("", 0, {}))
  File "/usr/local/lib/python3.6/site-packages/regex.py", line 436, in _compile
    pattern_locale = _getlocale()[1]
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/locale.py", line 581, in getlocale
    return _parse_localename(localename)
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/locale.py", line 490, in _parse_localename
    raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: UTF-8

This worked for me.

pip install -U spacy && python -m spacy download en

I can't, I have python3 and python does not exist as a command

I think this might work with python3
pip3 install spacy && python3 -m spacy download en

nope

Yea, try with conda
@whyboris in Python3 works

and in python 2.7 have an error to download link
you can check, with this command, the install models:
python -m spacy validate
here, you can see the model "en":
type link, name en, model ..., ver...

try the command:
sudo python -m spacy download en
wait a moment and you can see:
You can now load the model via spacy.load('en')

if you see Error: Couldn't link model to 'en'
you use
nlp = spacy.load('en_core_web_sm')
and works

simple which worked for me is install the wheel packages which we get from https://www.lfd.uci.edu/~gohlke/pythonlibs/
search for relevant wheel package and install them just by "pip install "

@FrancescoSaverioZuppichini
If you have faced the error on MacOS X, here's the quick fix - add these lines to your ~/.bash_profile:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Thank you, it works!

I found this work around to install the en module directly in the last comment, and it has worked for me:
https://github.com/explosion/spaCy/issues/916

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

notnami picture notnami  Â·  3Comments

peterroelants picture peterroelants  Â·  3Comments

norrishd picture norrishd  Â·  3Comments

nadachaabani1 picture nadachaabani1  Â·  3Comments

TropComplique picture TropComplique  Â·  3Comments