Can't import en_core_web_trf: AttributeError: module 'spacy.lang.en' has no attribute '__all__'
See original GitHub issueHow to reproduce the behaviour
I 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
- Operating System:
(Colab) Linux 5a8332f5cac4 4.19.112+ #1 SMP Thu Jul 23 08:00:38 PDT 2020 x86_64 x86_64 x86_64 GNU/Linux
- Python Version Used:
Python 3.6.9
- spaCy Version Used:
spacy-nightly==3.0.0rc5
- Environment Information:
Rain.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
AttributeError: module 'spacy' has no attribute 'load'
In Python distinctive files are modules, and therefore by naming it 'spacy', you overwrite the file and import itself.
Read more >Install spaCy · spaCy Usage Documentation
Import error: No module named spacy ... This error means that the spaCy module can't be located on your system, or in your...
Read more >Models & Languages · spaCy Usage Documentation
spaCy is a free open-source library for Natural Language Processing in Python. It features NER, POS tagging, dependency parsing, word vectors and more....
Read more >English · spaCy Models Documentation
spaCy is a free open-source library for Natural Language Processing in Python. It features NER, POS tagging, dependency parsing, word vectors and more....
Read more >spaCy 101: Everything you need to know
What's spaCy? spaCy is a free, open-source library for advanced Natural Language Processing (NLP) in Python. If you're working with a lot of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 😃
@ines could I update the install instructions for Colab?