InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.37k stars 660 forks source link

NumPy 2.0 support #4700

Closed jakirkham closed 1 month ago

jakirkham commented 1 month ago

NumPy 2.0 is coming out soon ( https://github.com/numpy/numpy/issues/24300 ). NumPy 2.0.0rc1 packages for conda & wheels came out at the beginning of April ( https://github.com/numpy/numpy/issues/24300#issuecomment-2030603395 ). Also NumPy is planning to release 2.0 on June 16th ( https://github.com/numpy/numpy/issues/24300#issuecomment-2125643448 )

To prepare for NumPy 2.0, it might be worthwhile to start testing against NumPy 2 in CI

NumPy has put out a migration guide. More details are in the release notes

If ITK makes use of NumPy's C API (and produces wheels that use it), having a release of ITK with wheels built against NumPy 2.0.0rc1 would be helpful to ensure NumPy 1 & 2 compatible wheels (as wheels built against NumPy 1 won't be compatible with NumPy 2). More details in this NumPy 2 ABI doc

Also as NumPy is tracking ecosystem support for NumPy 2.0, it would be helpful to share ITK current support status in issue (with any plans): https://github.com/numpy/numpy/issues/26191

thewtex commented 1 month ago

@jakirkham thanks for the issue and links! :pray:

ITK has NumPy 1 & 2 compatible wheels, including the recently released itk-5.4.0.

I added CI-testing for NumPy pre-releases (currently NumPy 2.0 RC 2) in #4701 .

ITK uses the Python Buffer Protocol to work with NumPy so there are not NumPy C API issues. itk-5.4.0 includes fixes for NumPy Python API deprecation warnings from 1.X.

jakirkham commented 1 month ago

Great thanks Matt! 🙏