Skip to content

np.random.bit_generator broken at 1.18 #15152

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

Closed
zjjott opened this issue Dec 23, 2019 · 7 comments · Fixed by #15156
Closed

np.random.bit_generator broken at 1.18 #15152

zjjott opened this issue Dec 23, 2019 · 7 comments · Fixed by #15156

Comments

@zjjott
Copy link

zjjott commented Dec 23, 2019

Reproducing code example:

import numpy as np
AttributeError: module 'numpy.random' has no attribute 'bit_generator'

Numpy/Python version information:

numpy==1.18

work fine at numpy==1.17.4, I have read release log,

In addition to the usual bug fixes, this NumPy release cleans up and documents the new random C-API, expires a large number of old deprecations

at 1.17, bit_generator is not at deprecation?

I have read numpy code at 1.18,this module move to np.random._bit_generator ,cause this broken

@mattip
Copy link
Member

mattip commented Dec 23, 2019

It is not a deprecation, it is a code change. You need to update your code. We probably should have mentioned it in the release notes.

@rgommers
Copy link
Member

This was done in gh-14608. The release note update would have been useful, we should probably still amend this since release notes get read for a long time. We don't often update those, but in this case it seems justified.

@jrounds
Copy link

jrounds commented Feb 3, 2020

I thought the point of depreciation was to not immediately break modules when there was a code change. They don't seem mutually exclusive.

I also thought it was good package management practice in high profile projects that if a user upgrades one release to the next that nothing breaks immediately without depreciation warnings

When np.random.random_integers changed to np.random.randint random_integers spammed depreciation warnings until this day. That was useful because code still ran and I could migrate over as I touched code. It is true that random_integer to randint changed the argument interpretation, so it was not just _"a code change", apparently, but the larger and more important thing to me actually using the interface, is you didn't just delete np.random.random_integer. You could have! But you didn't and I thank you for it!

@rkern
Copy link
Member

rkern commented Feb 3, 2020

Sometimes, we make mistakes. bit_generator should not have been exposed as a public module without a leading underscore to indicate that it was private. Given that this mistake was recently introduced and quickly fixed, simply fixing it was deemed the better option instead of letting the mistake exist for a longer time, even giving noisy warnings.

We should have more clearly signposted in the 1.17 release that we expected some mistakes of this nature given the size of this new subsystem and that we would simply fix them without a long deprecation period. We apologize for the inconvenience.

@iaakanksha
Copy link

Hello, at the time of using pandas-profiling it is showing me the error

ModuleNotFoundError: No module named numpy.random.bit_generator

Please help!!

@rkern
Copy link
Member

rkern commented Sep 30, 2021

I don't see any code in pandas-profiler that refers to bit_generator, so I suspect this is from something else. Find out what it is and update that code accordingly.

@iaakanksha
Copy link

I don't see any code in pandas-profiler that refers to bit_generator, so I suspect this is from something else. Find out what it is and update that code accordingly.

Thanks for the help the problem is solved!

sighingnow added a commit to sighingnow/v6d that referenced this issue Jan 24, 2022
See also: numpy/numpy#15152

Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants