Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimum required numpy version needs to be bumped to 1.17.0 #3137

Closed
shakhat opened this issue May 10, 2021 · 3 comments
Closed

Minimum required numpy version needs to be bumped to 1.17.0 #3137

shakhat opened this issue May 10, 2021 · 3 comments
Labels
bug Issue described a bug impact LOW Low impact on affected users reach LOW Affects only niche use-case users testing Issue related with testing (code, documentation, etc)

Comments

@shakhat
Copy link

shakhat commented May 10, 2021

Problem description

gensim is declared to work with numpy >= 1.11.3, however it doesn't work with any version below 1.17.0.

Steps/code/corpus to reproduce

Install gensim and non-recent version of numpy:

$ pip install "numpy<1.17.0" gensim

Run python interpreter with the following code

>>> import gensim

Observed error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/private/tmp/.venv/lib/python3.7/site-packages/gensim/__init__.py", line 11, in <module>
    from gensim import parsing, corpora, matutils, interfaces, models, similarities, utils  # noqa:F401
  File "/private/tmp/.venv/lib/python3.7/site-packages/gensim/parsing/__init__.py", line 4, in <module>
    from .preprocessing import (remove_stopwords, strip_punctuation, strip_punctuation2,  # noqa:F401
  File "/private/tmp/.venv/lib/python3.7/site-packages/gensim/parsing/preprocessing.py", line 26, in <module>
    from gensim import utils
  File "/private/tmp/.venv/lib/python3.7/site-packages/gensim/utils.py", line 62, in <module>
    default_prng = np.random.default_rng()
AttributeError: module 'numpy.random' has no attribute 'default_rng'

The solution is to bump the minimum version of numpy to be at least 1.17.0: https://github.com/RaRe-Technologies/gensim/blob/develop/setup.py#L318

Versions

>>> import numpy; print("NumPy", numpy.__version__)
NumPy 1.16.6
>>> import scipy; print("SciPy", scipy.__version__)
SciPy 1.6.3
@piskvorky
Copy link
Owner

Thanks for reporting.

@mpenkov I remember a discussion around numpy versions & bumping the requirements; do you remember what that was? And why we didn't follow through as reported here? Cheers!

@piskvorky piskvorky added bug Issue described a bug impact LOW Low impact on affected users reach LOW Affects only niche use-case users testing Issue related with testing (code, documentation, etc) labels May 10, 2021
@mpenkov
Copy link
Collaborator

mpenkov commented May 11, 2021

I think this is the discussion here: #3085

We did it for gensim-wheels, but not for gensim proper. It's a slightly different problem. I think we can bump the minimum version to 1.17.0 as mentioned in this ticket.

@piskvorky
Copy link
Owner

Fixed in #3156.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue described a bug impact LOW Low impact on affected users reach LOW Affects only niche use-case users testing Issue related with testing (code, documentation, etc)
Projects
None yet
Development

No branches or pull requests

3 participants