Load_learner stopped by ModuleNotFoundError: No module named 'spacy.lemmatizer'

Hi there,

I tested and exported my model which should be not too far from the npl in chapter 10.
I am not trying to create a python app with it, but on
learn = load_learner…
I get this error:
ModuleNotFoundError: No module named ‘spacy.lemmatizer’.
Installing spacy didn’t save the day, and I didn’t need to do that anyway with Colab.
Anyone?

R

1 Like

I had the same issue. So it turns out spacy.lemmatizer is not available in spacy v3. You need to use spacy v2.
I had to use spacy v2.2.4 for fastai v2.4.1. Other versions of spacy v2 are not working with fastai v2.4.1

Hello there!

import spacy
import en_core_web_sm
nlp = en_core_web_sm.load()
from spacy.lemmatizer import Lemmatizer

Issue:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-35-1c9274a07301> in <module>
     15 nlp = en_core_web_sm.load()
     16 
---> 17 from spacy.lemmatizer import Lemmatizer
     18 from spacy.lookups import Lookups
     19 

ModuleNotFoundError: No module named 'spacy.lemmatizer'

I cant downgrade to Spacy v2. Anyone find a correction? Is it an official issue in Sapcy? How works lemmatizer now in v3 please?

Thank you very much!

I don’t know how lemmatizer works in v3. You can downgrade by just executing:
pip install spacy==2.2.4

Hello,

As I said I can’t downgrade my install to v2. I’m looking for a valid code under v3…

Using V2 on a separate environment worked for me. Thank you amir01.