Skip to content
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

Update Numpy build-time requirement (time sensitive) #445

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

astrofrog
Copy link
Contributor

@astrofrog astrofrog commented Apr 5, 2024

This PR does a few things:

  • Since Numpy 1.25, the Numpy C API is backward-compatible and oldest-supported-numpy is no longer needed (see https://numpy.org/doc/stable/dev/depending_on_numpy.html#build-time-dependency for example), so we can get rid of oldest-supported-numpy in the build-time dependencies in pyproject.toml and just use numpy
  • As discussed in NumPy 2.0 development status & announcements numpy/numpy#24300 (comment), packages that depend on the Numpy C API will need new wheels compiled against Numpy 2.0 in order to be compatible with both Numpy 1.x and 2.x. These wheels should ideally be released before Numpy 2.0 is released. As Numpy 2.0.0rc1 is out and the ABI is guaranteed to no longer change, the recommendation from Numpy is that the build-time dependency on Numpy should be numpy>=2.0.0rc1. Then, if/once this PR is merged, new wheels of bottleneck should ideally be built ASAP.
  • I have also removed the deprecated requires= field from setup.py, updated setup_requires to also require Numpy 2.0.0rc1 or later.
  • Bump minimum required version of Python to 3.9 as Numpy 2.0 is not available on older versions and since Python 3.7 and 3.8 are now ancient.

Without this PR:

% python -m venv bt
% source bt/bin/activate
% pip install bottleneck numpy --pre
...
Successfully installed bottleneck-1.3.8 numpy-2.0.0rc1
% python -c "import bottleneck"

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0rc1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "<string>", line 1, in <module>
  File "/Users/tom/tmp/bt/lib/python3.11/site-packages/bottleneck/__init__.py", line 7, in <module>
    from .move import (move_argmax, move_argmin, move_max, move_mean, move_median,
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/tom/tmp/bt/lib/python3.11/site-packages/bottleneck/__init__.py", line 7, in <module>
    from .move import (move_argmax, move_argmin, move_max, move_mean, move_median,
ImportError: numpy.core.multiarray failed to import

@astrofrog astrofrog changed the title Update Numpy build-time requirement Update Numpy build-time requirement (time sensitive) Apr 5, 2024
setup.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@astrofrog
Copy link
Contributor Author

@rdbisme @neutrinoceros I've now simplified this to remove any unnecessary changes

setup.py Outdated Show resolved Hide resolved
@astrofrog
Copy link
Contributor Author

I think this is good to go?

setup.py Show resolved Hide resolved
setup.py Show resolved Hide resolved
Since it is not needed anymore with recent Numpy versions, and bump
minimum required Numpy to 2.0.0rc1 in order to be able to build Numpy
2-compatible wheels
@rdbisme rdbisme merged commit 1dc14d8 into pydata:master Apr 18, 2024
40 of 41 checks passed
@pllim
Copy link

pllim commented Apr 22, 2024

Hello! Any plans to push a pre-release out with this patch?

@rdbisme
Copy link
Collaborator

rdbisme commented May 4, 2024

https://pypi.org/project/Bottleneck/1.4.0rc4/

@bnavigator
Copy link
Contributor

#449 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants