pennylane icon indicating copy to clipboard operation
pennylane copied to clipboard

Pennylane is compatible with numpy 2.0

Open EmilianoG-byte opened this issue 6 months ago • 2 comments

Context:

Want to make Pennylane compatible with Numpy 2.0.

Description of the Change:

  • Update repo to use Numpy 2.0.0 and autograd 1.7.0.
  • Unpin Numpy version from setup.py
  • Update requirements-ci to include scipy 1.13 (this adds support for numpy 2.0)
  • Change np.NaN to np.nan
  • Use legacy printing representation in tests, contrary to the new numpy representation of scalars, e.g. np.float64(3.0) rather than just 3.0.
  • Update probabilities warning to be case insensitive and check for partial match, since this warning was changed in Numpy 2.0
  • Check datatype of np.exp from Global phase only for Numpy 1.x, since this gets promoted to complex128 in Numpy 2.x. https://numpy.org/neps/nep-0050-scalar-promotion.html#schema-of-the-new-proposed-promotion-rules

Benefits:

Make Pennylane compatible with Numpy 2.0.0

Possible Drawbacks:

Need to add further steps in the pipeline to ensure Pennylane is compatible with both Numpy 1.x and Numpy 2.x

[sc-61399] [sc-66548]

EmilianoG-byte avatar Aug 01 '24 16:08 EmilianoG-byte