Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load 'en' from spacy in jupyter notebook

I run the following lines of code in a jupyter notebook:

import spacy
nlp = spacy.load('en')

And get following error:

Warning: no model found for 'en_default'

Only loading the 'en' tokenizer.

I am using python 3.5.3, spacy 1.9.0, and jupyter notebook 5.0.0. I downloaded spacy using conda install spacy and python3 spacy install en. I am able to import spacy and load 'en' from my terminal but not from a jupyter notebook.

like image 747
PretentiousPanda Avatar asked Jan 04 '23 11:01

PretentiousPanda


2 Answers

Based on the answer in your comments, it seems fairly clear that the two Python interpreters for Jupyter and your system Python are not the same, and therefore likely do not have shared libraries between them.

I would recommend re-running the installation or just specifically installation the en tool in the correct Spacy. Replace the path with the full path to the file, if the above is not the full path.

//anaconda/envs/capstone/bin/python -m spacy download

That should be enough. Let me know if there are any issues.

like image 77
Alexander Huszagh Avatar answered Jan 14 '23 12:01

Alexander Huszagh


You can also download en language model in the jupyter notebook:

import sys
!{sys.executable} -m spacy download en
like image 43
Gaurav Kumar Avatar answered Jan 14 '23 13:01

Gaurav Kumar