-
Notifications
You must be signed in to change notification settings - Fork 557
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
Compatibility with NumPy 2.0 #1972
Comments
I don't see it mentioned above, but a recent change in numpy 2 seems to be that Cython modules (or anything using the numpy C API) must call Edit: It looks like shapely already runs tests against numpy 2 and is passing: https://github.com/shapely/shapely/actions/runs/7884170432/job/21512589917?pr=1990 Now I'm very confused at why my CI is failing. Edit 2: I suppose this means libgeos needs to be compiled with numpy 2 in my CI?
|
@djhoese do you have a link to the CI in question? (failing build) |
@jorisvandenbossche Here you go: https://github.com/pytroll/pyresample/actions/runs/7906385079/job/21581090150
|
The problem is that So one option is to change the line for shapely at https://github.com/pytroll/pyresample/blob/df92fb921f9116a819c21d75d8e6dba291622e4b/.github/workflows/ci.yaml#L66 to be Then that should ensure that shapely is built against the numpy 2.0 nightly you installed just before. Another option is to figure out how to ensure pip will also install nightly packages from the extra index during the build isolation, but that I don't know exactly what that would look like. |
FWIW we found that https://github.com/astropy/astropy/blob/2c98602609aaf7d41ef9b2b4416d17665d3910d0/tox.ini#L120 |
@jorisvandenbossche Thanks. What's sad is I actually knew I needed |
I am planning to do a 2.0.4 release next week to have wheels compatible with numpy 2.0 |
This is done in the meantime: https://github.com/shapely/shapely/releases/tag/2.0.4 |
NumPy 2.0 is coming soon, and we should ensure shapely is fully compatible to ensure a smooth transition of our users. Overview issue on numpy's side:
Quick summary of the most important aspects for us:
numpy<2
pin.This happens at the moment when installing shapely from a wheel in an environment with numpy nightly.
oldest-supported-numpy
anymore (https://numpy.org/devdocs/release/1.25.0-notes.html#compiling-against-the-numpy-c-api-is-now-backwards-compatible-by-default and https://github.com/scipy/oldest-supported-numpy#deprecation-notice-for-numpy-20), so for newer Python versions (where the minimum supported version of numpy is <=1.25), we can start compiling with the latest numpy.This also helps with the point above, because once numpy 2.0 is released, we can therefore built against numpy 2.0 and have a resulting wheel that can run with both numpy 1.x and 2.0. See https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-0-specific-advice for more details.
We don't yet test with numpy nightly
A to do list based on my current understanding:
--pre
in the dev build, so we only get a dev numpy when they do a beta or RC release). This will ensure that shapely at least builds and runs fine with the upcoming numpy. -> TST: test against numpy nightly #1973numpy<2
pin, so that when numpy 2.0 is out and someone doespip install shapely
, you don't get a broken env. Therefore, for the maintenance 2.0.x branch:numpy<2
pin to the requirements in the maintenance branch -> COMPAT: Add a numpy<2 pin to install requirements for 2.0.x #1975requires
to use latest numpy instead ofoldest-supported-numpy
-> BLD: update build-system requires to use latest numpy instead of oldest-supported-numpy + build nightly wheels with numpy nightly #1974copy
changes in(as)array
and__array__
__array__
to accept a copy keywordThe text was updated successfully, but these errors were encountered: