Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named 'gensim.sklearn_api' how to resolve

Im little confuse i would like use texthero library for some pca analysis. But when i trying run my code :

import texthero as hero
import pandas as pd


df['pca']=(df['clean_tweet'].pipe(hero.clean).pipe(hero.do_tfidf).pipe(hero.do_pca))
hero.scatterplot(df, col='pca', color='topic', title="PCA BBC Sport news")

I get error:

ModuleNotFoundError: No module named 'gensim.sklearn_api

But when i put !pip show gensim. i got

Name: gensim
Version: 4.0.1
Summary: Python framework for fast Vector Space Modelling
Home-page: http://radimrehurek.com/gensim
like image 833
Przemek Dabek Avatar asked Oct 22 '25 23:10

Przemek Dabek


1 Answers

It seems that the module "gensim.sklearn_api" has been removed with version 4 of Gensim. Try downgrading Gensim's version.

python -m pip install gensim==3.8.3

Reference: https://github.com/RaRe-Technologies/gensim/wiki/Migrating-from-Gensim-3.x-to-4

like image 140
Silvia Avatar answered Oct 24 '25 13:10

Silvia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!