-
Notifications
You must be signed in to change notification settings - Fork 2.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
[BUG]: latest pybind11 (2.11.1) version not supporting numpy 2.0 #5009
Comments
Thanks for having a look @Skylion007. It's not entirely clear what "help wanted" means here - a non-maintainer can't really help with doing a new release I suspect. I did test the master branch of this repo with SciPy a while back, and that all looked good. |
I will note that there is one serious change that pybind11 will notice and will have to act on. And that is that we really need to change the This isn't a particularly difficult change of course, but it will require a version dependent use of a different struct to look up some of the members. (Direct access of this struct isn't very common in downstream outside pybind11 since you would rather use macros like |
Any ETA on the RC? That would make it easier to test with. I really wish our NumPy support was pulled out into it's own module, that would have allowed a potential alternative module for NumPy 2 using the API instead of having to work with the integrated one, but it is what it is. |
I am working on the last steps for the most interesting changes and I think I am making decent progress. We will need to see how this affects Scipy. I hope it just doesn't matter in practice and you can basically fix it with some leisure during the rc period. |
Sorry that it took a bit, there was a bit of a back and forth and I was on a long planned vacation. In either case, this would be the change: numpy/numpy#25943. The most important point is that The important thing is that it would be great to get this, and just as important the import location change, into a new release soon (and if it is a |
Can I contribute to this issue? |
I have created gh-5050 with the necessary fixes. Some users might be unhappy (if they use structured dtypes, which I doubt many will, but you never know) so we might have to follow up eventually with adding helpers for them. Otherwise, I think it should be fine, I slightly hoping that there is no major reason not to stick with the current |
Fixed by gh-5050, which is included in the just-released pybind11 2.12.0 release. Thanks everyone! |
* Related to some of the complex discussion at: pybind/pybind11#5009 * It seems we are lower bounded by a recent enough `pybind11` in `pyproject.toml` that it should now be safe to clean this up. Full testsuite passed locally with NumPy 1.x and 2.x from clean build slate. [skip circle] [skip cirrus]
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
2.11.1
Problem description
Hi pybind11 devs, I'd like to request a new release to support numpy 2.0. The first release candidate for numpy 2.0 is expected in early February. The underlying issue for 2.0 support was addressed ~3 months ago in gh-4857.
Right now,
numpy
is trying to warn users testing a nightly ormain
that there is an issue when digging into private internals of numpy, and the message specifically mentionspybind11
not being compatible (most probably root cause):After that message, the offending code may yield an exception (happens for, e.g., Matplotlib) or silently continue like nothing else happened (happens for, e.g., Dask). The latter is especially confusing - some dependency of Dask is using
pybind11
, but it's not even possible to see which one (dask
itself is pure Python).Once numpy
2.0.0rc1
appears on PyPI, a lot more users are going to see the above message and be confused, or come to this issue tracker. The frequency will go up both because a lot of packages use--pre
in their CI and because the numpy team will strongly encourage users to test that RC. A new release containing gh-4857 soon would be very helpful.EDIT: additional reason: other libraries need to release new versions with wheels that work with numpy 2.0 - and if there's no new
pybind11
release by then, it looks like they have to usepybind11
for their next releases. That's really undesirable.Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered: