3

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

Poala Astrid
  • 1,028
  • 2
  • 10
nad
  • 2,640
  • 11
  • 55
  • 96
  • Did you restart your kernel after installing spaCy? – polm23 Oct 26 '21 at 03:28
  • @polm23 I did but same issue – nad Oct 26 '21 at 15:49
  • If you use `import sys` like at the question linked here, is the path the same as the one `which` gives? https://stackoverflow.com/questions/2589711/find-full-path-of-the-python-interpreter – polm23 Oct 27 '21 at 06:28

1 Answers1

2

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.)

jkr
  • 17,119
  • 2
  • 42
  • 68