numpy 2.0, astropy 6.0, and you

120 views
Skip to first unread message

Pey Lian Lim

unread,
Dec 7, 2023, 2:00:14 PM12/7/23
to astropy-dev
To whom it may concern,

numpy 2.0 is coming out soon (next month or two, it looks like); see https://github.com/numpy/numpy/issues/24300 for more details on what changed. There will be breaking changes, both in API and ABI.

If you build your own C-extension, for it to work with numpy 2.0, your package needs to be ***built*** with numpy 2.0.

If you use someone else's package with C-extension, you need to ask that person to ***build*** the package with numpy 2.0 for you to be able to run your own package in numpy 2.0.

Supposedly a package built with numpy 2.0 will have backward compatible ABI with numpy 1.x (to some degree). This means that even when you build your package with numpy 2.0, people can still use your package with numpy 1.x (theoretically) unless you also use API that was removed in numpy 2.0.

So, what does this all mean to you?

When numpy 2.0 is released, you won't be able to install a stable version of astropy until astropy rebuilds with numpy 2.0 and then releases an astropy version that is compatible (probably v6.0.1). astropy 6.0.0 will ***not*** work with numpy 2.0 because astropy 6.0.0 was built with numpy 1.x.

But before astropy can do that, pyerfa first needs to rebuild with numpy 2.0 and releases that.

And then, if you use any other packages in the same situation (scipy, scikit-image, scikit-learn, matplotlib, etc, etc), you have to wait for them to do the same.

And then, if you use conda (not pip), you have to wait for all those to get ingested into the conda recipes and builds.

tl;dr -- When numpy 2.0 is released, do not expect to be able to use that immediately with other packages. Expect a few weeks/months of chaos, but then things should settle down.

Hope this helps clarify the matter,
Pey Lian
Reply all
Reply to author
Forward
0 new messages