question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SPACY IMPORT ERROR!

See original GitHub issue

How to reproduce the problem

“I’ve tried updating new versions of thinc and spacy as directed from previous issue posts.” Its flagging a import error.

# copy-paste the error message here

ImportError Traceback (most recent call last) <ipython-input-8-cb604e7f192b> in <module> 1 import pandas as pd 2 import string ----> 3 import spacy 4 from collections import Counter 5 from spacy.lang.en import English

~/opt/anaconda3/lib/python3.7/site-packages/spacy/init.py in <module> 8 9 # These are imported as part of the API —> 10 from thinc.api import prefer_gpu, require_gpu # noqa: F401 11 from thinc.api import Config 12

ImportError: cannot import name ‘prefer_gpu’ from ‘thinc.api’ (/Users/lexroverts/opt/anaconda3/lib/python3.7/site-packages/thinc/api.py)

Your Environment

  • Operating System:IOS Mac
  • Python Version Used: 3.7.6
  • spaCy Version Used: 2.1.8
  • Environment Information: Screen Shot 2020-11-09 at 2 23 33 PM

I need help trying to get spacy to work again on Jupiter notebooks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
adrianeboydcommented, Nov 10, 2020

pip lets you update packages even if this might cause conflicts with other currently installed packages. Notice the warnings at the bottom of the install message that show which packages are incompatible. Updating thinc independently from spacy can lead to mismatches. (In general it’s easier for us to help if the errors are pasted as text in a code block instead of as images, thanks!)

You may be able to fix your current virtual environment with pip install spacy==2.3.2. You also don’t want to have spacy and spacy-nightly installed in the same environment, so please uninstall with pip uninstall spacy-nightly. (Unless you want the prerelease version, then uninstall spacy and follow install instructions here: https://nightly.spacy.io/usage)

If that doesn’t work, we’d recommend starting with a new virtual environment and just installing spacy (pip install spacy, optionally with the stable version you’d like), which will pull in the correct versions of all the dependencies.

0reactions
github-actions[bot]commented, Oct 30, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
spacy import fail · Issue #4782 · explosion/spaCy - GitHub
This error occurs, as stated above, when you have a mismatch between the installed CUDA version and the installed spaCy version. You can...
Read more >
ImportError: No module named 'spacy.en' - Stack Overflow
I've looked on Stackexchange and the closest is: Import error with spacy: "No module named en" which does not solve my problem.
Read more >
Import error: No module named en - spacy - YouTube
Import error : No module named en - spacy #nomodulenameden #pipinstall #python # spacy #NLP #motechapp.
Read more >
spacy - PyPI
import spacy nlp = spacy.load("en_core_web_sm") doc = nlp("This ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found