Spacy: Model not installed.

Created on 8 Apr 2016  路  8Comments  路  Source: explosion/spaCy

when I run the
nlp = spacy.en.English() or spacy.load('en') in the windows with version 0.100.6

Traceback (most recent call last):
File "C:Program Files (x86)JetBrainsPyCharm 5.0.1helperspydevpydevd.py", line 2403, in
globals = debugger.run(setup['file'], None, None, is_module)
File "C:Program Files (x86)JetBrainsPyCharm 5.0.1helperspydevpydevd.py", line 1794, in run
launch(file, globals, locals) # execute the script
File "C:/Users/artemis_zrj/PycharmProjects/sentence_analyse/sub/data_processing/yelp/save_yelp_data.py", line 4, in
nlp = spacy.en.English()
File "C:Usersartemis_zrjAnaconda2libsite-packagesspacylanguage.py", line 225, in init
package = util.get_package_by_name()
File "C:Usersartemis_zrjAnaconda2libsite-packagesspacyutil.py", line 30, in get_package_by_name
"model." % name)
RuntimeError: Model None not installed. Please run 'python -m spacy.en.download' to install latest compatible model.
Process finished with exit code 1

But the data is existed in the dir , site-packagesspacydata__cache__ en-1.0.9 ,I tried to download the data again,but it is not useful.

>>> import spacy
>>> from spacy.en import English
>>> import sputnik
>>> pkg = sputnik.package(spacy.about.__title__, spacy.about.__version__, 'en')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\artemis_zrj\Anaconda2\lib\site-packages\sputnik\__init__.py", line 160, in package
    return pool.get(package_string)
  File "C:\Users\artemis_zrj\Anaconda2\lib\site-packages\sputnik\package_list.py", line 57, in get
    raise PackageNotFoundException(package_string)
sputnik.package_list.PackageNotFoundException: en
>>> spacy
<module 'spacy' from 'C:\Users\artemis_zrj\Anaconda2\lib\site-packages\spacy\__init__.pyc'>
>>>

How can I load the model correctly?

Most helpful comment

@Shylajhaa I probably found the solution to this, from here:

python -m spacy download en

should work.

All 8 comments

It looks to me as if the model is not installed. How did you install spacy, via conda, pip or from source? Also, did you upgrade from a previous spacy version or did you install from scratch?

Did you run python -m spacy.en.download and it exited successfully? What happens if you run it again?

The directory you are pointing at (spacy\data__cache__\en-1.0.9) is a cache directory, its not the model data directory. Please run the following commands and post the output here:

python -m sputnik --name spacy find

This should print all installed/available models.

python -c "import sputnik; print(sputnik.util.default_data_path('spacy'))"

This should print the path where the model files are stored on your system.

I remenber update it with pip,and I forget how it be installed.
I copy the previous version of 0.100.5 and It can run nlp = spacy.en.English() but spacy.load('en') can't find the model too.
I have once run python -m spacy.en.download successfully. But when I download it again, it will stop with error, but It maybe the network reason.
Now, with the version of 0.100.5.
`python -m sputnik --name spacy find' with the output

[
{
"name": "en_default",
"version": "1.0.8"
}
]

and python -c "import sputnik; print(sputnik.util.default_data_path('spacy'))" with the output:

C:Usersartemis_zrjAnaconda2libsite-packagesspacydata

>>> import spacy
>>> spacy.load('en')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\artemis_zrj\Anaconda2\lib\site-packages\spacy\__init__.py", line 6, in load
    package = util.get_package_by_name(name, via=via)
  File "C:\Users\artemis_zrj\Anaconda2\lib\site-packages\spacy\util.py", line 28, in get_package_by_name
    raise RuntimeError("Model not installed. Please run 'python -m "
RuntimeError: Model not installed. Please run 'python -m spacy.en.download' to install latest compatible model.

I tryed it with the version of 0.100.6 in the env.

Python 2.7.11 |Continuum Analytics, Inc.| (default, Jan 29 2016, 14:26:21) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import spacy
>>> spacy.en.English()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "F:\code\test\.env\lib\site-packages\spacy\language.py", line 225, in __init__
    package = util.get_package_by_name()
  File "F:\code\test\.env\lib\site-packages\spacy\util.py", line 30, in get_package_by_name
    "model." % name)
RuntimeError: Model None not installed. Please run 'python -m spacy.en.download' to install latest compatible model.
>>> spacy.load("en")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "F:\code\test\.env\lib\site-packages\spacy\__init__.py", line 7, in load
    package=util.get_package_by_name(name, via=via),
  File "F:\code\test\.env\lib\site-packages\spacy\util.py", line 30, in get_package_by_name
    "model." % name)
RuntimeError: Model en not installed. Please run 'python -m spacy.en.download' to install latest compatible model.
>>>

(.env) F:\code\test\.env>python -m sputnik --name spacy find
[
  {
    "name": "en_default",
    "version": "1.0.8"
  }
]

(.env) F:\code\test\.env>python -c "import sputnik; print(sputnik.util.default_data_path('spacy'))"
F:\code\test\.env\lib\site-packages\spacy\data

the data is existed in the dir spacydataen_default-1.0.8?

Sorry, I have a hard time following what you write. By copying the model you might have complicated the situation. I recommend you to try to set it up from scratch again, specifically as you are on anaconda you could try:

conda create -n spacy python
source activate spacy
conda install spacy
python -m spacy.en.download
python -c "import spacy; spacy.load('en')"

It works. Thank you. : )

Error while finding module specification for 'spacy.en.download' (ModuleNotFoundError: No module named 'spacy.en')

I'm getting this error while executing "python -m spacy.en.download"

@Shylajhaa I probably found the solution to this, from here:

python -m spacy download en

should work.

Seeing the following error:

Exception:
Traceback (most recent call last):
File "C:Anaconda3libsite-packagespipbasecommand.py", line 215, in main
status = self.run(options, args)
File "C:Anaconda3libsite-packagespipcommandsinstall.py", line 324, in run
requirement_set.prepare_files(finder)
File "C:Anaconda3libsite-packagespipreqreq_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:Anaconda3libsite-packagespipreqreq_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:Anaconda3libsite-packagespiputilspackaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:Anaconda3libemailfeedparser.py", line 178, in feed
self._input.push(data)
File "C:Anaconda3libemailfeedparser.py", line 104, in push
self._partial.write(data)
TypeError: string argument expected, got 'NoneType'

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