Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error installing en model #950

Closed
spotlightai opened this issue Apr 3, 2017 · 8 comments
Closed

Error installing en model #950

spotlightai opened this issue Apr 3, 2017 · 8 comments
Labels
install Installation issues osx Issues related to macOS / OSX

Comments

@spotlightai
Copy link

spaCy was installed smoothly like this:

sudo pip install spacy

I am however unable to install the en model when I run:

python -m spacy download en

The error I get is as follows:

Downloading en_core_web_sm-1.2.0/en_core_web_sm-1.2.0.tar.gz

Collecting https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-1.2.0/en_core_web_sm-1.2.0.tar.gz
Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-1.2.0/en_core_web_sm-1.2.0.tar.gz (52.2MB)
100% |████████████████████████████████| 52.2MB 2.2MB/s
Requirement already satisfied (use --upgrade to upgrade): en-core-web-sm==1.2.0 from https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-1.2.0/en_core_web_sm-1.2.0.tar.gz in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: spacy<2.0.0,>=1.7.0 in /usr/local/lib/python2.7/site-packages (from en-core-web-sm==1.2.0)
Requirement already satisfied: requests<3.0.0,>=2.13.0 in /usr/local/lib/python2.7/site-packages (from spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: six in /usr/local/lib/python2.7/site-packages/six-1.10.0-py2.7.egg (from spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: pathlib in /usr/local/lib/python2.7/site-packages (from spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: plac<1.0.0,>=0.9.6 in /usr/local/lib/python2.7/site-packages (from spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: preshed<2.0.0,>=1.0.0 in /usr/local/lib/python2.7/site-packages (from spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: cymem<1.32,>=1.30 in /usr/local/lib/python2.7/site-packages (from spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: thinc<6.6.0,>=6.5.0 in /usr/local/lib/python2.7/site-packages (from spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: numpy>=1.7 in /usr/local/lib/python2.7/site-packages (from spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: dill<0.3,>=0.2 in /usr/local/lib/python2.7/site-packages (from spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: ujson>=1.35 in /usr/local/lib/python2.7/site-packages (from spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: murmurhash<0.27,>=0.26 in /usr/local/lib/python2.7/site-packages (from spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: cytoolz<0.9,>=0.8 in /usr/local/lib/python2.7/site-packages (from thinc<6.6.0,>=6.5.0->spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: termcolor in /usr/local/lib/python2.7/site-packages (from thinc<6.6.0,>=6.5.0->spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: wrapt in /usr/local/lib/python2.7/site-packages (from thinc<6.6.0,>=6.5.0->spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: tqdm<5.0.0,>=4.10.0 in /usr/local/lib/python2.7/site-packages (from thinc<6.6.0,>=6.5.0->spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Requirement already satisfied: toolz>=0.8.0 in /usr/local/lib/python2.7/site-packages (from cytoolz<0.9,>=0.8->thinc<6.6.0,>=6.5.0->spacy<2.0.0,>=1.7.0->en-core-web-sm==1.2.0)
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/site-packages/spacy/main.py", line 109, in
plac.Interpreter.call(CLI)
File "/usr/local/lib/python2.7/site-packages/plac_ext.py", line 1142, in call
print(out)
File "/usr/local/lib/python2.7/site-packages/plac_ext.py", line 914, in exit
self.close(exctype, exc, tb)
File "/usr/local/lib/python2.7/site-packages/plac_ext.py", line 952, in close
self._interpreter.throw(exctype, exc, tb)
File "/usr/local/lib/python2.7/site-packages/plac_ext.py", line 964, in make_interpreter
arglist = yield task
File "/usr/local/lib/python2.7/site-packages/plac_ext.py", line 1139, in call
raise
(task.etype, task.exc, task.tb)
File "/usr/local/lib/python2.7/site-packages/plac_ext.py", line 380, in wrap
for value in genobj:
File "/usr/local/lib/python2.7/site-packages/plac_ext.py", line 95, in gen_exc
raise
(etype, exc, tb)
File "/usr/local/lib/python2.7/site-packages/plac_ext.py", line 966, in _make_interpreter
cmd, result = self.parser.consume(arglist)
File "/usr/local/lib/python2.7/site-packages/plac_core.py", line 207, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
File "/usr/local/lib/python2.7/site-packages/spacy/main.py", line 31, in download
cli_download(model, direct)
File "/usr/local/lib/python2.7/site-packages/spacy/cli/download.py", line 25, in download
link_package(model_name, model, force=True)
File "/usr/local/lib/python2.7/site-packages/spacy/cli/link.py", line 27, in link_package
symlink(model_path, link_name, force)
File "/usr/local/lib/python2.7/site-packages/spacy/cli/link.py", line 52, in symlink
link_path.symlink_to(model_path)
File "/usr/local/lib/python2.7/site-packages/pathlib.py", line 1167, in symlink_to
self._accessor.symlink(target, self, target_is_directory)
File "/usr/local/lib/python2.7/site-packages/pathlib.py", line 392, in symlink
return os.symlink(str(a), str(b))
OSError: [Errno 13] Permission denied

Environment:

  • Operating system: macosx
  • Python version: 2.7
  • spaCy version: 1.7

Many thanks, Stephane

@ines
Copy link
Member

ines commented Apr 3, 2017

I think the cause here might be that your user does not have the required permissions to create symlinks. To make it easy to install models wherever you want (as pip packages or manually) and load them by name, spaCy creates a symbolic link in the spacy/data directory. It looks like the model has installed correctly, but failed to create the symbolic link. (For more info, see this section in the troubleshooting guide.)

You could try the following:

  • Run the same command (or only python -m spacy link en_core_web_sm en) as administrator.
  • If that's not possible, use a virtualenv and install spaCy in a user directory (we usually recommend this approach, because it keeps things cleaner)
  • If this fails, you can always create a symlink manually: place it in spacy/data and link it to the model data directory.
  • Alternatively, you can also find the model data directory en_core_web_sm-1.2.0 (somewhere in your site-packages, or simply redownload and unzip the archive) and copy-paste it into spacy/data. You can rename the model directory to anything you want, and then use the exact name of that directory to load the model, for example: spacy.load('my_model') if the directory is called my_model.

@ines ines added install Installation issues osx Issues related to macOS / OSX labels Apr 3, 2017
@crosscue
Copy link

crosscue commented Apr 4, 2017

Experiencing the same issue. In my case it seems to be due to using a VMware workstation (Ubuntu) with Windows 10 as a host OS and attempting to install spacy to a shared work directory on the host (within a virtualenv). Symlinks aren't supported in this scenario.

@ines
Copy link
Member

ines commented Apr 5, 2017

Yeah, there might be some cases where this problem seems pretty hard to prevent...

But when designing the new download and link commands, we definitely tried to make sure to never fully depend on the commands and mainly add them as a convenience layer. You'll always be able to do things manually and copy-paste the data, or simply use the models as modules instead:

import en_core_web_sm
nlp = en_core_web_sm.load()

Some people actually prefer this way of loading models over spacy.load(), as it's cleaner and lets you manage the models as proper dependencies, rather than relying on spaCy to resolve arbitrary shortcut links.

@ines ines closed this as completed Apr 8, 2017
@tonywangcn
Copy link

"python -m spacy link en_core_web_sm en" worked for manually download en_core in browser and install with pip. Should be documented in here in detail . Cost me few hours to solved such problem.

@rrmehdi
Copy link

rrmehdi commented Feb 1, 2018

Could you please provide more details about your solution? I can't seems resolve this problem yet on my MacBook. I am using spaCy version 2.0.5 and python 3.6.3 |Anaconda

@rrmehdi
Copy link

rrmehdi commented Feb 1, 2018

NVM, after I did python -m spacy download en_core_web_sm, everything seems working fine with:
import en_core_web_sm
nlp = en_core_web_sm.load()

@diplodata
Copy link

Ubuntu 16.4:

$ python -m spacy link en_core_web_sm en
Can't locate model data
The data should be located in en_core_web_sm

@lock
Copy link

lock bot commented May 7, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
install Installation issues osx Issues related to macOS / OSX
Projects
None yet
Development

No branches or pull requests

6 participants