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 in downloading English model in Spacy #916

Closed
debayandaw opened this issue Mar 24, 2017 · 2 comments
Closed

Error in downloading English model in Spacy #916

debayandaw opened this issue Mar 24, 2017 · 2 comments
Labels
windows Issues related to Windows

Comments

@debayandaw
Copy link

For importing spacy:

>import spacy
>nlp = spacy.load('en')

Error:


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

C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy_init_.pyc in load(name, **overrides)
49 overrides['path'] = model_path
50
---> 51 return cls(**overrides)
52
53

C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy\en_init_.pyc in init(self, **overrides)
38 # Special-case hack for loading the GloVe vectors, to support <1.0
39 overrides = fix_glove_vectors_loading(overrides)
---> 40 Language.init(self, **overrides)

C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy\language.pyc in init(self, **overrides)
286
287 self.vocab = self.Defaults.create_vocab(self)
--> 288 if 'vocab' not in overrides
289 else overrides['vocab']
290 add_vectors = self.Defaults.add_vectors(self) \

C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy\language.pyc in create_vocab(cls, nlp)
56 else:
57 vocab = Vocab.load(nlp.path, lex_attr_getters=cls.lex_attr_getters,
---> 58 tag_map=cls.tag_map, lemmatizer=lemmatizer)
59 for tag_str, exc in cls.morph_rules.items():
60 for orth_str, attrs in exc.items():

C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy\vocab.pyx in spacy.vocab.Vocab.load (spacy/vocab.cpp:4768)()
99 serializer_freqs = None
100
--> 101 with (path / 'vocab' / 'strings.json').open('r', encoding='utf8') as file_:
102 strings_list = json.load(file_)
103 cdef Vocab self = cls(lex_attr_getters=lex_attr_getters, tag_map=tag_map,

C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\pathlib.pyc in open(self, mode, buffering, encoding, errors, newline)
1075 opener=self._opener)
1076 else:
-> 1077 return io.open(str(self), mode, buffering, encoding, errors, newline)
1078
1079 def touch(self, mode=0o666, exist_ok=True):

IOError: [Errno 2] No such file or directory: 'C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy\data\en\vocab\strings.json'


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

#Error while installing English model in spacy
Traceback (most recent call last):
File "C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy\en\download.py", line 5, in
download.en()
File "C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy\deprecated.py", line 136, in en
cls.load('en')
File "C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy\deprecated.py", line 132, in load
download(lang)
File "C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy\cli\download.py", line 25, in download
link_package(model_name, model, force=True)
File "C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy\cli\link.py", line 27, in link_package
symlink(model_path, link_name, force)
File "C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\spacy\cli\link.py", line 46, in symlink
link_path.symlink_to(model_path)
File "C:\Users\debayan.daw\AppData\Local\Continuum\Anaconda2\lib\site-packages\pathlib.py", line 1167, in symlink_to
self._accessor.symlink(target, self, target_is_directory)
TypeError: symlink() takes exactly 3 arguments (4 given)

error snapshot

##Environment Information:

  • Python version: 2.7.13
  • Platform: Windows-10-10.0.10586
  • spaCy version: 1.7.2
  • *Installed models:
@ines
Copy link
Member

ines commented Mar 24, 2017

Thanks for the report – this looks like the same issue as #909 (closing this issue to keep the discussion in one place). There seem to be some general problem with symlinks on Windows, which is how models are linked to their shortcut, including a bug in pathlib.

While we're working on a Windows-only workaround, you can always install the models via pip and load them as a Python module:

pip install https:/explosion/spacy-models/releases/download/en_core_web_sm-1.2.0/en_core_web_sm-1.2.0.tar.gz
import spacy
import en_core_web_sm

nlp = en_core_web_sm.load()

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 ines closed this as completed Mar 24, 2017
@ines ines added the windows Issues related to Windows label Mar 24, 2017
@lock
Copy link

lock bot commented May 9, 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 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
windows Issues related to Windows
Projects
None yet
Development

No branches or pull requests

2 participants