Skip to content
Advertisement

ImportError cannot import name Deque with spacy

I’m trying to import spacy to use on VSCode, but I am getting an error: “Exception has occurred: ImportError cannot import name Deque.”

I did pip install -U spacy in my virtual environment. Wondering how to solve the error so that I can use spacy? This import error goes away if I try other Python libraries. For ex, “import nltk” works fine.

Error Message

Advertisement

Answer

It is recommended that you reinstall the module “spacy” in the currently selected Python environment (the python environment shown in the lower left corner of VS Code). You could use the command “pip show spacy“(or pip3 show spacy) to check the installation location of the module:

enter image description here

Debug:

enter image description here

If it still doesn’t work, please try to reinstall the python extension and reload VS Code.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement