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

Replace np.alltrue() with np.all() #1371

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

iyanmv
Copy link

@iyanmv iyanmv commented Dec 22, 2024

Summary

numpy.alltrue() was deprecated in NumPy 1.25.0 and removed in NumPy 2.0. Because of this, test_h2 fails on recent versions of NumPy.

This PR simply replaces np.alltrue() with np.all() as recommended by the NumPy 2.0 migration guide. Test will continue to work on older versions of NumPy.

Details and comments

Fixes: #1370

numpy.alltrue() was deprecated in NumPy 1.25.0 and removed in NumPy 2.0.
Because of this, test_h2 fails on recent versions of NumPy.

Fixes: qiskit-community#1370
@CLAassistant
Copy link

CLAassistant commented Dec 22, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Collaborator

@ftroisi ftroisi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me, thanks!

@mrossinek @woodsp-ibm it looks like the pipelines are failing for three reasons:

  1. The macos pipelines are failing because the Conda environment cannot be created correctly. On Windows and Ubuntu that step works.
  2. For all pipelines, it looks like the package networkx is using np.float_, which is not supported in numpy>=2.0.0. From the pipeline logs it looks like we are using networkx==2.5.1, whereas the last version is the 3.4.2:
Collecting networkx<2.6,>=2.2 (from -r requirements-dev.txt (line 19))
  Downloading networkx-2.5.1-py3-none-any.whl.metadata (4.9 kB)

This error is likely to be fixed by changing the requirements-dev.txt.
3. Both pylint and mypy are failing due to errors unrelated to this PR. I can take care of that in another PR

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.

TestBravyiKitaevSuperFastMapper::test_h2 fails with NumPy >= 2.0
3 participants