Forums

ModuleNotFoundError: No module named 'spacy'

Dear all,

I receive above mentioned error, when I want to RUN the test.py file. The file is saved in /home/MainPimp01/.virtualenvs/spacy-virtualenv/test.py. The spacy module is installed under /home/MainPimp01/.virtualenvs/spacy-virtualenv/lib/python3.6/site-packages/spacy/data/de. Why do I get this error? I do not want to create a webapp. I just want to run the script in the test.py

Thanks MainPimp01

Are you running the script using python3.6?

Dear Glenn,

no I didnt, it was 3.7. So used #!/usr/bin/python3.6 to run this script with 3.6. The python 3.6 seemed to start well, it said starting python 3.6, BUT the error is still the same:

Traceback (most recent call last): File "/home/MainPimp01/.virtualenvs/spacy-virtualenv/test.py", line 2, in <module> import spacy ModuleNotFoundError: No module named 'spacy'

Just in case it helps, here is the script:

#!/usr/bin/python3.6 import spacy nlp = spacy.load('en_core_web_sm') doc = nlp(u'Apple is looking at buying U.K. startup for $1 billion') for token in doc: print(token.text, token.pos_, token.dep_)

Any other ideas? Thanks MainPimp01

/usr/bin/python3.6 is not the python version that has access to your virtualenv. Make sure that you've activated your virtualenv before running your script.

Well that worked. Thanks