spaCy icon indicating copy to clipboard operation
spaCy copied to clipboard

Spacy Model installation issue

Open HardikShah289 opened this issue 9 years ago • 6 comments

Trying to install and link model en_default.

python -m spacy download en_core_web_sm python -m spacy link en_core_web_sm en_default

Outpunt:C:\rasa_nlu-master>python -m spacy link en_core_web_sm en_default Traceback (most recent call last): File "C:\Python27\lib\runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "C:\Python27\lib\runpy.py", line 72, in run_code exec code in run_globals File "C:\Python27\lib\site-packages\spacy_main.py", line 138, in plac.Interpreter.call(CLI) File "C:\Python27\lib\site-packages\plac_ext.py", line 1142, in call print(out) File "C:\Python27\lib\site-packages\plac_ext.py", line 914, in exit self.close(exctype, exc, tb) File "C:\Python27\lib\site-packages\plac_ext.py", line 952, in close self._interpreter.throw(exctype, exc, tb) File "C:\Python27\lib\site-packages\plac_ext.py", line 964, in make_interpret er arglist = yield task File "C:\Python27\lib\site-packages\plac_ext.py", line 1139, in call raise(task.etype, task.exc, task.tb) File "C:\Python27\lib\site-packages\plac_ext.py", line 380, in wrap for value in genobj: File "C:\Python27\lib\site-packages\plac_ext.py", line 95, in gen_exc raise(etype, exc, tb) File "C:\Python27\lib\site-packages\plac_ext.py", line 966, in make_interpret er cmd, result = self.parser.consume(arglist) File "C:\Python27\lib\site-packages\plac_core.py", line 207, in consume return cmd, self.func(*(args + varargs + extraopts), **kwargs) File "C:\Python27\lib\site-packages\spacy_main.py", line 48, in link cli_link(origin, link_name, force) File "C:\Python27\lib\site-packages\spacy\cli\link.py", line 12, in link link_package(origin, link_name, force) File "C:\Python27\lib\site-packages\spacy\cli\link.py", line 27, in link_packa ge symlink(model_path, link_name, force) File "C:\Python27\lib\site-packages\spacy\cli\link.py", line 50, in symlink subprocess.call(command, shell=True) File "C:\Python27\lib\subprocess.py", line 168, in call return Popen(*popenargs, **kwargs).wait() File "C:\Python27\lib\subprocess.py", line 390, in init errread, errwrite) File "C:\Python27\lib\subprocess.py", line 595, in _execute_child args = list2cmdline(args) File "C:\Python27\lib\subprocess.py", line 262, in list2cmdline needquote = (" " in arg) or ("\t" in arg) or not arg # TypeError: argument of type 'WindowsPath' is not iterable

Your Environment

  • Python version: 2.7.13
  • Platform: Windows-2012ServerR2-6.3.9600
  • spaCy version: 1.7.5
  • Installed models:

HardikShah289 avatar Apr 10 '17 11:04 HardikShah289

Thanks for the report!

Damn, I thought the updates to the Windows symlink workaround would have finally fixed the symlinking/path issues here. We'll look into this.

In the meantime, you can always create the symlinks manually (in spacy/data), or simply import the models as modules:

import en_core_web_sm
nlp = en_core_web_sm.load()

ines avatar Apr 10 '17 11:04 ines

So, in above .pys, in which .py i should add above two lines? I am new to this.. sorry.

Thanks for your help.

HardikShah289 avatar Apr 10 '17 13:04 HardikShah289

i have created file symlinks.py under /python27/Lib/Site-packages/spacy/data

and added below lines.

import en_core_web_sm nlp = en_core_web_sm.load()

Then I again try to run the link command but got the same error.

HardikShah289 avatar Apr 10 '17 13:04 HardikShah289

image

this helped me

HardikShah289 avatar Apr 10 '17 14:04 HardikShah289

Thanks for updating – glad you got it to work by manually creating the symlink!

About the code snippet: You can use this method of loading the models instead of spacy.load('en') etc. in your own code. For example, your script could look something like this:

import spacy
import en_core_web_sm

nlp = en_core_web_sm.load()
doc = nlp(u'This is a sentence')
for word in doc:
    print(word.text, word.lemma_)

ines avatar Apr 10 '17 14:04 ines

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[bot] avatar May 09 '18 00:05 lock[bot]