I am getting the following error when importing import texthero as hero

Question:

I have been trying to load texthero into python but keep getting this error. I have already upgraded the gensim module.

Error

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-24-0692be95f55a> in <module>()
----> 1 import texthero as hero
      2 import pandas as pd

1 frames
/usr/local/lib/python3.7/dist-packages/texthero/preprocessing.py in <module>()
     22 warnings.filterwarnings(action="ignore", category=UserWarning, module="gensim")
     23 
---> 24 from gensim.sklearn_api.phrases import PhrasesTransformer
     25 
     26 

ModuleNotFoundError: No module named 'gensim.sklearn_api'
Asked By: unaied

||

Answers:

Try

pip install -U gensim

And

pip install texthero
Answered By: Rathish Kumar B

Seems like a potential conflict with a newer version of gensim, in my case 4.0.1.

pip install "gensim==3.8.1"

solved this for me.

Answered By: Frodnar

There’s some issue with newer version. Try installing older version.
pip install texthero==1.0.5 –> it’ll do the magic

Answered By: Goura Mohanty

The following two commands worked for me:

pip install "gensim==4.2.0"
pip install "texthero==1.0.5"

looks like that package pair is compatible.

Answered By: N00dle
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.