Spacy link error

二次信任 提交于 2019-12-18 14:38:35

问题


When running:

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

the following is printed:

Warning: no model found for 'en' Only loading the 'en' tokenizer.

/site-packages/spacy/data is empty with the exception of the init file. all filepaths are only pointing to my single installation of python.

Any help appreciated on resolving this.

Thanks! Will


回答1:


I had this same issue when I tried this on Windows 10 - the problem was the output of python -m spacy.en.download all said Linking successful but above that was the message that the symbolic link wasn't actually created, due to permissions.

Running python -m spacy.en.download all as an Adminstrator fixed the problem.




回答2:


You might need to install the specific module too after installing spacy. Try:

python -m spacy.en.download all

Here is the reference link: https://pypi.python.org/pypi/spacy




回答3:


If you’ve installed a model via pip, you can also import it directly and then call its load() method:

python -m spacy download en

import spacy
import en_core_web_sm

nlp = en_core_web_.load()
doc = nlp(u'This is a sentence.')



回答4:


run cmd as an administrator ,then download the model en package

python -m spacy download en



回答5:


In my case I had a previous installation of spacy that had created the symlink.

ls -al "/usr/local/lib/python3.5/dist-packages/spacy/data/en"
lrwxrwxrwx 1 root staff 74 Dec  5 00:40 /usr/local/lib/python3.5/dist-packages/spacy/data/en -> /usr/local/lib/python3.5/dist-packages/en_core_web_sm/en_core_web_sm-1.2.0

rm "/usr/local/lib/python3.5/dist-packages/spacy/data/en"

python3 -m spacy download en

And then everything is good.




回答6:


This works for Ubuntu users.

sudo python -m spacy download en



回答7:


I got around this by simply importing the model instead of performing nlp = spacy.load('en')




回答8:


In windows user name can be added in "Create symbolic link" in "Local security policy" before downloading en. It is working for me.




回答9:


First you need to train the model. After training, You need to go through a saving and loading process. After that, I hope It'll work. Good Luck. Since they updated the spacy version, find it Here



来源:https://stackoverflow.com/questions/43459437/spacy-link-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!