Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'spacy' even though spacy and python are in the same path

I am following the spaCy installation guideline inside my AWS SageMaker notebook

pip install -U pip setuptools wheel
pip install -U spacy
python -m spacy download en_core_web_sm

When I do import spacy I get error

ModuleNotFoundError: No module named 'spacy' 

I made sure my python and spacy path are same

What am I missing? enter image description here

like image 533
nad Avatar asked Oct 29 '25 17:10

nad


1 Answers

If you are installing spacy from inside the jupyter notebook, use the %pip syntax. That will use the pip associated with the kernel in use.

%pip install spacy

If installing from the command line, use

python -m pip install spacy

(Replace python with the path to the Python used in the notebook kernel.)

like image 91
jakub Avatar answered Nov 01 '25 07:11

jakub