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

Ensure compatibility with numpy 2.0.0 #12602

Closed
migueltorrescosta opened this issue Jun 18, 2024 · 4 comments
Closed

Ensure compatibility with numpy 2.0.0 #12602

migueltorrescosta opened this issue Jun 18, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@migueltorrescosta
Copy link

migueltorrescosta commented Jun 18, 2024

Environment

  • Qiskit version: 1.1.0
  • Python version: 3.12
  • Operating system: Linux

What is happening?

Installing qiskit in an environment with numpy 2.0.0 installed, causes the installation to fail

How can we reproduce the issue?

I started an empty environment with poetry, and ran poetry add numpy@latest and poetry add qiskit. The same can be achieved using other package managers.

What should happen?

We get a successful installation

Any suggestions?

Packages are gradually moving to numpy 2.0.0. While not necessarily urgent, eventually this will become a hurdle to most of our users, making this an important issue. If relevant, I observed this stdout locally:

❯ poetry install
Updating dependencies
Resolving dependencies... (0.4s)

Because no versions of rustworkx match >0.14.0,<0.14.1 || >0.14.1,<0.14.2 || >0.14.2
 and rustworkx (0.14.0) depends on numpy (>=1.16.0,<2), rustworkx (>=0.14.0,<0.14.1 || >0.14.1,<0.14.2 || >0.14.2) requires numpy (>=1.16.0,<2).
And because rustworkx (0.14.1) depends on numpy (>=1.16.0,<2)
 and rustworkx (0.14.2) depends on numpy (>=1.16.0,<2), rustworkx (>=0.14.0) requires numpy (>=1.16.0,<2).
Because no versions of qiskit match >1.1.0,<2.0.0
 and qiskit (1.1.0) depends on rustworkx (>=0.14.0), qiskit (>=1.1.0,<2.0.0) requires rustworkx (>=0.14.0).
Thus, qiskit (>=1.1.0,<2.0.0) requires numpy (>=1.16.0,<2).
So, because test depends on both qiskit (^1.1.0) and numpy (^2.0.0), version solving failed.
@migueltorrescosta migueltorrescosta added the bug Something isn't working label Jun 18, 2024
@jakelishman
Copy link
Member

As a library, Qiskit 1.1 supports Numpy 2.0 (see #11999 and linked PRs). The problem you're flagging here is that one of our dependencies (rustworkx) hasn't yet released a version that's rebuilt against Numpy 2.0 - you might want to take your issue over there.

In the immediate term, you can build Rustworkx from source, since iirc it should already be compatible from source, it's just that the release wheels haven't been re-issued.

Unless there's more to discuss, I'll close this as "already completed" - there's nothing more we can do from this repository about the support.

@jakelishman
Copy link
Member

Rustworkx should be ready - apparently I was even the one who relaxed the pin, though I don't remember doing it (Qiskit/rustworkx#1156).

@migueltorrescosta
Copy link
Author

migueltorrescosta commented Jun 20, 2024

Thank you for the explanation 👌 I still get the above error, however I assume that the issue is that the latest version of qiskit does not include the version relaxation from rustworkx yet: If I do poetry add qiskit we get numpy==1.26.4 :

❯ poetry install --no-root
Installing dependencies from lock file

No dependencies to install or update
❯ poetry show
dill              0.3.8       serialize all of Python
mpmath            1.3.0       Python library for arbitrary-precision floating-point arithmetic
numpy             1.26.4      Fundamental package for array computing in Python
pbr               6.0.0       Python Build Reasonableness
python-dateutil   2.9.0.post0 Extensions to the standard Python datetime module
qiskit            1.1.1       An open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
rustworkx         0.14.2      A python graph library implemented in Rust
scipy             1.13.1      Fundamental algorithms for scientific computing in Python
six               1.16.0      Python 2 and 3 compatibility utilities
stevedore         5.2.0       Manage dynamic plugins for Python applications
symengine         0.11.0      Python library providing wrappers to SymEngine
sympy             1.12.1      Computer algebra system (CAS) in Python
typing-extensions 4.12.2      Backported and Experimental Type Hints for Python 3.8+

The above done was done on a freshly created poetry environment, to ensure no caches were being used

@jakelishman
Copy link
Member

We have no upper-bound pun on Rustworkx. Rustworkx main branch supports Numpy 2.0, but they haven't made a Numpy 2 compatible release on PyPI yet.

Poetry is telling you this in its log messages too - there's no upper bound on Rustworkx, but no release of it supports Numpy 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants