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

Migrating to NumPy 2.0 #1403

Closed
scarrazza opened this issue Jul 24, 2024 · 9 comments · Fixed by #1582
Closed

Migrating to NumPy 2.0 #1403

scarrazza opened this issue Jul 24, 2024 · 9 comments · Fixed by #1582
Assignees
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Milestone

Comments

@scarrazza
Copy link
Member

At some point, we should also take into account migrating to NumPy 2.0, now that is out.

A much relevant improvement (to us) could be the following:
https://numpy.org/doc/stable/release/2.0.0-notes.html#array-api-compatible-functions-aliases
https://numpy.org/doc/stable/release/2.0.0-notes.html#array-api-compatible-functions-for-numpy-linalg
https://numpy.org/doc/stable/release/2.0.0-notes.html#array-api-standard-support-in-the-main-namespace

It was already documented for v1, and there are compatibility packages available
https://numpy.org/doc/stable/reference/array_api.html
but now it is available by default, and it should improve the compatibility with the other array frameworks (i.e. TensorFlow, PyTorch, JAX, CuPy, ...), since the Python API has been standardized (not all of them adopted it already, but they might do it).

Originally posted by @alecandido in #1395 (comment)

@glpatcern
Copy link

Ciao @MatteoRobbiati, @scarrazza, are you going to look into this migration any time soon?

I've got a request about this from the SWAN service at CERN, as they plan to move to numpy 2.0 and would potentially need to uninstall Qibo.

@MatteoRobbiati
Copy link
Contributor

MatteoRobbiati commented Jan 24, 2025

Ciao @MatteoRobbiati, @scarrazza, are you going to look into this migration any time soon?

I've got a request about this from the SWAN service at CERN, as they plan to move to numpy 2.0 and would potentially need to uninstall Qibo.

Ciao @glpatcern!
We have to solve some dependencies we still have in the tests with machine learning backends (mostly related to Keras and it's integration of Numpy 2.0). After this, we plan to support it indeed!

@glpatcern
Copy link

Hey @MatteoRobbiati, I guess this will take some time yet, right? I see there's also #1484 that is kind of related, but did not find any PR specifically addressing numpy 2.

At the moment, the SWAN team is ready to migrate to a new set of packages that support numpy 2 and python 3.12, and unless we (you) provide some context or roadmap, they may drop Qibo to give precedence to all the rest.

@alecandido
Copy link
Member

Hey @MatteoRobbiati, I guess this will take some time yet, right? I see there's also #1484 that is kind of related, but did not find any PR specifically addressing numpy 2.

Hi @glpatcern. Indeed, the two are actually unrelated.

At the moment, the SWAN team is ready to migrate to a new set of packages that support numpy 2 and python 3.12, and unless we (you) provide some context or roadmap, they may drop Qibo to give precedence to all the rest.

Python 3.12 is fully supported (it came in #1231).

Concerning NumPy 2, I do not see any special dependency issue, nor any major problem. The API is in general pretty similar, so it is mostly (and most likely) a matter of testing, and fixing the minor differences that will arise in the process.
But no one has taken over the task, so I guess it is not happening immediately. Unless someone volunteers for this.

@MatteoRobbiati we may discuss the issue at the next meeting, to see if there is anyone willing to actually perform the migration.

@glpatcern
Copy link

Hi @alecandido, thanks for jumping in - good to learn that the TensorFlow dependency should not be an issue with going to NumPy 2 (with Python 3.12).

Have you had your meeting / did you assess what the migration would entail in terms of actual work?

@alecandido
Copy link
Member

Have you had your meeting / did you assess what the migration would entail in terms of actual work?

I would say, no one volunteered. I will directly check with the most likely candidates (one of which is @MatteoRobbiati himself :P), but otherwise it will just stall...

@alecandido alecandido linked a pull request Feb 10, 2025 that will close this issue
4 tasks
@renatomello renatomello added this to the Qibo 0.2.17 milestone Mar 11, 2025
@renatomello renatomello added enhancement New feature or request dependencies Pull requests that update a dependency file labels Mar 11, 2025
@glpatcern
Copy link

Hey there, glad to see this work got completed earlier than one could expect!

Are you going to issue a new tag/release?

@alecandido
Copy link
Member

We have a release schedule of about 1 month. I'm not sure when it will be next one. Usually, by the end of the month, but we're not really strict about it.

In any case, since this is relevant for some user, and the next upcoming technical update (i.e. py3.13 support #1484) as well, we could even consider anticipating it.

@renatomello
Copy link
Contributor

renatomello commented Mar 11, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants