Skip to content

BUG: Add object cast to avoid warning with limited API#26995

Merged
charris merged 1 commit into
numpy:maintenance/2.0.xfrom
charris:backport-26985
Jul 20, 2024
Merged

BUG: Add object cast to avoid warning with limited API#26995
charris merged 1 commit into
numpy:maintenance/2.0.xfrom
charris:backport-26985

Conversation

@charris
Copy link
Copy Markdown
Member

@charris charris commented Jul 20, 2024

Backport of #26985.

To be honest, I think we should just delete this from the public API. But I thought I'll start with this, since at least in principle that isn't a bug-release thing to backport.

I am not sure setting warnings to errors is wise (at least for Cython and MSVC). OTOH, the Cython module currently truly does nothing except include the headers (it doesn't even use the NumPy .pyd yet).

Closes gh-26756

To be honest, I think we should just delete this from the public API.
But I thought I'll start with this, since at least in
principle that isn't a bug-release thing to backport.

I am not sure setting warnings to errors is wise (at least for Cython and
MSVC).  OTOH, the Cython module currently truly does nothing except
include the headers (it doesn't even use the NumPy `.pyd` yet).
@charris charris added 00 - Bug 08 - Backport Used to tag backport PRs labels Jul 20, 2024
@charris charris added this to the 2.0.1 release milestone Jul 20, 2024
@charris charris merged commit 4d10ffc into numpy:maintenance/2.0.x Jul 20, 2024
@charris charris deleted the backport-26985 branch July 20, 2024 02:02
joeycarter added a commit to PennyLaneAI/catalyst that referenced this pull request Oct 7, 2024
**Context:** Catalyst currently contains the NumPy requirement
`numpy==2.0` in several places (e.g. `requirements.txt`) and
`numpy<=2.0` in `setup.py`. If a version of NumPy more recent than 2.0.0
is already installed by `pip`, these requirements force Catalyst to use
NumPy 2.0.0. However, NumPy 2.0.0 contains a bug that's blocking the use
of the numpy C API with the Stable ABI in Catalyst. This bug was fixed
in NumPy 2.0.1: numpy/numpy#26995 (the original
issue was written up here: numpy/numpy#26756).
Changing the NumPy requirement to `numpy!=2.0.0` ensures that we avoid
the problematic NumPy version, which is necessary as we replace pybind11
with nanobind in Catalyst to use the Stable ABI. Moreover, it also
explicitly allows Catalyst to be installed with more recent versions of
NumPy. Note that other packages on which Catalyst depends may impose
implicit requirements on the version of NumPy used, e.g. PennyLane
currently requires `numpy<2.1`.

**Description of the Change:** Changes NumPy requirement to
`numpy!=2.0.0`. Also updates the PennyLane dependency to
`pennylane==0.39.0.dev30` to capture
PennyLaneAI/pennylane#6342, which resolves
related NumPy-dependency conflicts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00 - Bug 08 - Backport Used to tag backport PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants