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

2 Likes

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.

1 Like

This version is no more available on today’s date. I got following error on running statement pip install spacy==2.2.4

“Error: No matching distribution found for spacy==2.2.4”

@asifdegr8 It is available. Pip install works fine on my system. May you need to update your python version. If still no success, you can download and install relevant wheel from spacy · PyPI

I have followed all the listed solutions yet couldn’t solve the issue
Please Help
Screenshot 2022-07-27 at 11.05.37 AM

1 Like

I ran into the exact same problem. I ended up using spacy 3.4.4 and using this code: SpaCy Lemmatizer use in Lesson 2 · Issue #3 · fastai/course-nlp · GitHub