-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Description
When trying to import Word2Vec from gensim in Google Colab, I consistently encounter a "ModuleNotFoundError: No module named 'numpy.char'" error, despite successful installation of gensim and its dependencies.
Environment
- Platform: Google Colab
- Python version: 3.11
- gensim version: 4.3.3
- numpy version: 1.26.4
- scipy version: 1.13.1
Steps to reproduce
- Install gensim in a Google Colab notebook:
!pip install gensim
- Try to import Word2Vec:
from gensim.models import Word2Vec
Error message
ModuleNotFoundError Traceback (most recent call last)
in <cell line: 0>()
1 #!pip install --no-cache-dir --force-reinstall gensim
2 # !pip install gensim
----> 3 from gensim.models import Word2Vec
4 import os
5 from tqdm import tqdm
9 frames
/usr/local/lib/python3.11/dist-packages/numpy/init.py in getattr(attr)
365 raise AssertionError()
366 except AssertionError:
--> 367 msg = ("The current Numpy installation ({!r}) fails to "
368 "pass simple sanity checks. This can be caused for example "
369 "by incorrect BLAS library being linked in, or by mixing "
ModuleNotFoundError: No module named 'numpy.char'
What I've tried
- Installing specific versions of numpy and scipy
- Using
--no-cache-dir
and--force-reinstall
flags - Trying multiple versions of gensim
- Creating a mock numpy.char module (worked temporarily but then broke again)