Reputation: 91
import spacy
nlp = spacy.load('en_core_web_sm')
**Error:** Traceback (most recent call last):
File "C:\Users\PavanKumar\.spyder-py3\ExcelML.py", line 27, in <module>
nlp = spacy.load('en_core_web_sm')
AttributeError: module 'spacy' has no attribute 'load'
Can anyone suggest me a solution?
Upvotes: 8
Views: 11683
Reputation: 412
I had the same problem, and it turned out the error was caused by naming the file 'spacy', apparently it creates a naming conflict. In Python distinctive files are modules, and therefore by naming it 'spacy', you overwrite the file and import itself. Consequently, you should not name your files with package names and they will work well. Once I renamed the file into something else, it worked flawlessly.
Upvotes: 0
Reputation: 59
Try installing spacy again, I had the same problem, after running conda install spacy
and restarting my notebook kernel it worked.
For the complete installation documentation check the spacy official website: spacy documentation
Upvotes: 3