Skip to content

import gensim fails on Windows with numpy 1.19.5 #3095

@Bomme

Description

@Bomme

Problem description

After I upgraded to gensim 4.0.0 from 4.0.0beta, I was no longer able to do import gensim (see numpy error message below). When I upgraded to numpy 1.20.2 the problem was solved.

Steps/code/corpus to reproduce

Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gensim
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\Dev\code\venv\lib\site-packages\gensim\__init__.py", line 11, in <module>
    from gensim import parsing, corpora, matutils, interfaces, models, similarities, utils  # noqa:F401
  File "C:\Users\user\Dev\code\venv\lib\site-packages\gensim\corpora\__init__.py", line 6, in <module>
    from .indexedcorpus import IndexedCorpus  # noqa:F401 must appear before the other classes
  File "C:\Users\user\Dev\code\venv\lib\site-packages\gensim\corpora\indexedcorpus.py", line 14, in <module>
    from gensim import interfaces, utils
  File "C:\Users\user\Dev\code\venv\lib\site-packages\gensim\interfaces.py", line 19, in <module>
    from gensim import utils, matutils
  File "C:\Users\user\Dev\code\venv\lib\site-packages\gensim\matutils.py", line 1024, in <module>
    from gensim._matutils import logsumexp, mean_absolute_difference, dirichlet_expectation
  File "gensim\_matutils.pyx", line 1, in init gensim._matutils
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
>>>

Versions

Windows-10-10.0.19041-SP0
Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32
Bits 64

NumPy 1.19.5
scipy 1.6.0
gensim 4.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue described a bugimpact HIGHShow-stopper for affected usersreach HIGHAffects most or all Gensim users

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions