I am trying to run 'en' for Spacy library, which took a lot of debugging to install and finally got it to import in the python library. Next step to load 'en', I spent lot of time debugging why I can't load the files and unable to load in any type of scenarios.
# in Python: These libraries are getting loaded.
import spacy
import ujson
import en_core_web_sm
In Command Line/ linux: I used command below to download 'en' for spacy.
python -m spacy download en
I got this successful message
"You can now load the model via spacy.load('en')."
Then I tried to run this and got this error in Python.
nlp = spacy.load('en')
doc = nlp(u'This is a sentence.')
Error: ImportError: [E048] Can't import language en from spacy.lang.
What I have tried?:
1) Download the jar file insert into this path: spacy.util.get_data_path()
2) Loading the files like this spacy.load('C:/path_to/Anaconda3/lib/site-packages/spacy/data/en')
including jar file name passed in the spaces.
3) Running java -jar en_core_web_sm-2.0.0a7.tar
and java -jar en-1.1.0.tar
before running the script. It fails.
Any idea how to solve this? Greatly appreciated!
I had the same error, try using
python -m spacy download en_core_web_sm
instead of
python -m spacy download en
In fact, the 'en' package is just a shortcut for the statistical model 'en_core_web_sm'.
如果您已升级到最新的 3.X 版本的 spacy 并遇到此错误 - 最好卸载以前的版本并重新安装最新版本。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.