Can't import en_core_web_trf: AttributeError: module 'spacy.lang.en' has no attribute '__all__' #7363
-
How to reproduce the behaviourI am using what loads at this time as spacy-nightly[transformers,cuda100], on Google Colab's Python3. The following code was run: !pip install snorkel spacy-nightly[transformers,cuda100] --pre
import spacy
import spacy_transformers
from spacy.cli import download
download("en_core_web_trf")
nlp = spacy.load("en_core_web_trf") The following exception occurs: ---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-19-911d29e313e9> in <module>()
----> 1 nlp = spacy.load("en_core_web_trf")
7 frames
/usr/local/lib/python3.6/dist-packages/spacy/util.py in get_lang_class(lang)
AttributeError: module 'spacy.lang.en' has no attribute '__all__' Your Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Hi! This is a super strange error and I've never seen this before 🤔 I just tried it in Colab and I can't reproduce it, it all runs fine for me and loads as expected? Maybe something got corrupted when Colab installed If you still have your Colab env open, what happens if you |
Beta Was this translation helpful? Give feedback.
-
This is a long shot, but did you try restarting the kernel after doing the pip install? |
Beta Was this translation helpful? Give feedback.
-
You were correct. I had installed The solution to install this in Colab is: !yes | pip uninstall spacy
!pip install spacy-nightly[cuda100,transformers] --pre After this the following code runs fine: import spacy
import spacy_transformers
from spacy.cli import download
download("en_core_web_trf")
nlp = spacy.load("en_core_web_trf") However, download now seems superfluous according to the debug output, since load can download. @honnibal is there a relevant place in the documentation to add this? I would like to make my first PR if there is :) |
Beta Was this translation helpful? Give feedback.
-
Glad it worked! 👍
|
Beta Was this translation helpful? Give feedback.
-
@ines could I update the install instructions for Colab? |
Beta Was this translation helpful? Give feedback.
You were correct. I had installed
spacy-nightly
without uninstalling the includedspacy
first. Then I installedspacy-nightly
and removed the originalspacy
, which messed things up.The solution to install this in Colab is:
After this the following code runs fine:
However, download now seems superfluous according to the debug output, since load can download.
@honnibal is there a relevant place in the documentation to add this? I would like to make my first PR if there is :)