-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix miscellaneous numpy=2.0
errors
#8117
Conversation
note that with more modern versions of `numpy` the `.astype(np.str_)` don't actually change the dtype, so maybe we can remove those.
not sure what to do with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - I think this can be merged?
Isn't np.float_
and float
equivalent (https://numpy.org/doc/stable/user/basics.types.html)?
Not for numpy 2.0, where it has been removed: https://numpy.org/devdocs/release/2.0.0-notes.html#numpy-2-0-python-api-removals. Maybe just replacing |
Right, thanks. I found no deprecation warning or error in our upstream-dev CI, though. Maybe that's still to come? Anyway, given the description that seems to be the right approach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR.
Maybe we should add some type ignores to silence Mypy. Still not sure what the best approach is in such cases.
Yeah we'll need to do something about the. mypy errors:
|
We can't, as we cannot know the default floating-point size in advance: as far as I remember, 32bit OSs (windows in particular) still have
I'd be tempted to just add |
this should be ready for merging now. Note that there are lots of failing upstream-dev mypy errors and |
numpy suggests replacing |
FYI looking through the mypy upstream errors, they're almost all matplotlib (with a couple of numpy ones) |
See #8030 |
np.unicode_
was removed in the NumPy 2.0 release. Usenp.str_
instead #8133Edit: looking at the relevant
numpy
issues, it appearsnumpy
will stay a bit unstable for the next few weeks / months. Not sure how quickly we should try to adapt to those changes.