-
Notifications
You must be signed in to change notification settings - Fork 279
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
TST: NumPy 2 compatibility tracker #4874
Conversation
An aspect I hadn't considered earlier is that some packages may have dropped support for Python 3.9 before adding compatibility with numpy 2.0, in which case a brand new env in Python 3.9 may be broken. I'm not going to worry about that right now but it's something to keep in mind if CI breaks specifically on 3.9 even after all our optional dependencies have a numpy2-compatible release. update 16-05-2024: this was debated on numpy's mailing list so hopefully awareness of this problem is higher now. |
My understanding is that netcdf4 maintainers do not wish to build off of a numpy release candidate and are waiting for the final stable release, but the dev branch is already compatible, so I don't expect it to be a blocker for long. |
…ptional dependencies still lack compat
b4c1592
to
6e048f0
Compare
Ok so I'm seeing progress. It seems that everything we depend on now has ABI-compatible wheels but we're seeing 3 failing tests around astropy. I was already aware of runtime incompatibilities between astropy 6.1.0 and numpy 2.0, and they are fixed on the dev branch. I informed astropy's release managers and a bugfix release should be coming soon. |
wait I may actually have fabricated this situation by forcing the dependency resolver to look for a version of astropy that
it's probably not an issue with astropy itself |
Ok we are down to two failing answer tests https://tests.yt-project.org/job/yt_py310_git/8249/testReport/, both in the enzo frontend. |
well this took a while... but for the failed isolated galaxy test with np 2, the grid field values have a dtype of float64 while with np<2 they are float32. here's the test script I was running to look directly at values (rather than hashed values) based on what
With np 2.0.0rc2, that dtypes prints out After a way too long I traced this down to the calculation of relative velocity. The raw velocity components get read in as
with np 2.0.0rc2, you get a float64 whereas with np1.26.4 you get a float32. |
the difference in type promotion is described here: https://numpy.org/devdocs/numpy_2_0_migration_guide.html#changes-to-numpy-data-type-promotion :
|
and the reason why enzo has these fields as >f4 without upcasting is that they're read in f4: Lines 144 to 145 in e9ba8ac
and then the Lines 115 to 125 in e9ba8ac
|
Thanks a lot for digging into this ! So, since the change is externally controlled and intended, we should just bump then, right ? |
yes, I think just bump. |
Cool. I'll open the bump PR as soon as I'm notified numpy 2.0 landed on PyPI ! |
double checked in #4927 that it was indeed the new type promotion causing the failure (it was). IMO bumping the answers is still the way to go given how it is standard across io methods to cast up to float64. But if there's any reason to not cast, #4927 would be a potential approach (@matthewturk feel free to chime in if you have an opinion here). |
Numpy 2.0 is out and (almost) didn't disrupt our CI. This PR served its purpose. Thanks @chrishavlin for your help ! |
PR Summary
This PR isn't meant to be merged
I've been watching numpy/numpy#26191
At the time I'm opening this, all our core dependencies (matplotlib, unyt, ewah-bool-utils) already have compatible releases.
This will unleash full CI with numpy 2 at runtime to reveal which of our optional and transitional dependencies still lack support for it, so I have a chance to reach out to them before the final release drops.
This table may be incomplete, but CI doesn't forgive, which is why this is a PR and not an issue.
edit history:
2024/04/12 created
2024/04/13
2024/05/05 new entry: astropy
2024/06/14: xarray and netcdf4 moved to ✅ status, astropy degraded to 🟠