Skip to content

ModuleNotFoundError: No module named 'numpy.char' when importing Word2Vec #3605

@TomEinhorn

Description

@TomEinhorn

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

  1. Install gensim in a Google Colab notebook: !pip install gensim
  2. 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

  1. Installing specific versions of numpy and scipy
  2. Using --no-cache-dir and --force-reinstall flags
  3. Trying multiple versions of gensim
  4. Creating a mock numpy.char module (worked temporarily but then broke again)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions