jbesomi / texthero

Text preprocessing, representation and visualization from zero to hero.
https://texthero.org
MIT License
2.88k stars 240 forks source link

ModuleNotFoundError: No module named 'gensim.sklearn_api' on import #236

Open clstaudt opened 10 months ago

clstaudt commented 10 months ago
import texthero
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
[/Users/cls/Documents/Work/Projects/Beiersdorf/SubProjects/CognitiveSearch/TopicLabelling/cognitive-search-topic-labelling/notebooks/dev-bertopic-tutorial.ipynb](https://file+.vscode-resource.vscode-cdn.net/Users/cls/Documents/Work/Projects/Beiersdorf/SubProjects/CognitiveSearch/TopicLabelling/cognitive-search-topic-labelling/notebooks/dev-bertopic-tutorial.ipynb) Cell 12 line 1
----> [1](vscode-notebook-cell:/Users/cls/Documents/Work/Projects/Beiersdorf/SubProjects/CognitiveSearch/TopicLabelling/cognitive-search-topic-labelling/notebooks/dev-bertopic-tutorial.ipynb#Y100sZmlsZQ%3D%3D?line=0) import texthero

File [~/miniforge3/envs/bdf-cognitive-search-gpu/lib/python3.10/site-packages/texthero/__init__.py:6](https://file+.vscode-resource.vscode-cdn.net/Users/cls/Documents/Work/Projects/Beiersdorf/SubProjects/CognitiveSearch/TopicLabelling/cognitive-search-topic-labelling/notebooks/~/miniforge3/envs/bdf-cognitive-search-gpu/lib/python3.10/site-packages/texthero/__init__.py:6)
      1 """Texthero: python toolkit for text preprocessing, representation and visualization.
      2 
      3 
      4 
      5 """
----> 6 from . import preprocessing
      7 from .preprocessing import *
      9 from . import representation

File [~/miniforge3/envs/bdf-cognitive-search-gpu/lib/python3.10/site-packages/texthero/preprocessing.py:24](https://file+.vscode-resource.vscode-cdn.net/Users/cls/Documents/Work/Projects/Beiersdorf/SubProjects/CognitiveSearch/TopicLabelling/cognitive-search-topic-labelling/notebooks/~/miniforge3/envs/bdf-cognitive-search-gpu/lib/python3.10/site-packages/texthero/preprocessing.py:24)
     20 import warnings
     22 warnings.filterwarnings(action="ignore", category=UserWarning, module="gensim")
---> 24 from gensim.sklearn_api.phrases import PhrasesTransformer
     27 def fillna(input: pd.Series) -> pd.Series:
     28     """Replace not assigned values with empty spaces."""

ModuleNotFoundError: No module named 'gensim.sklearn_api'
➤ pip show gensim
Name: gensim
Version: 4.3.2
Summary: Python framework for fast Vector Space Modelling
Home-page: https://radimrehurek.com/gensim/
Author: Radim Rehurek
Author-email: me@radimrehurek.com
License: LGPL-2.1-only
Location: /Users/cls/miniforge3/envs/bdf-cognitive-search-gpu/lib/python3.10/site-packages
Requires: numpy, scipy, smart-open
Required-by: bpemb, flair, texthero, top2vec

texthero installed with:

pip install --upgrade texthero --only-binary=gensim

(compiling gensim failed, therefore only binary)

pyacobellis commented 3 months ago

Any work or update on this? I am facing same issue, affecting use of Top2Vec API (need latest version of gensim for ngram modelling).

DanielOX commented 3 months ago

same