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

Switch tests and documentation to use qiskit-ibm-runtime fake backends #1369

Merged
merged 4 commits into from
Feb 2, 2024

Conversation

wshanks
Copy link
Collaborator

@wshanks wshanks commented Jan 23, 2024

The IBM-specific fake backends in Qiskit are being removed in Qiskit 1.0 in Qiskit/qiskit#11376. The same fake backends have been moved to qiskit-ibm-runtime in
Qiskit/qiskit-ibm-runtime#1140 and follow up PRs.

Here the qiskit imports are replaced with qiskit-ibm-runtime imports in order to provide a smooth transition between Qiskit 0.45 and Qiskit 1.0. In the future, it may be preferable to use generic fake backends maintained in the repo and not depend on qiskit-ibm-runtime for them.

Additionally, this commit reorders the requirements-dev.txt file so it
is easier to read and adds qiskit-ibm-runtime as a development
dependency. It also temporarily pins qiskit to 0.45 while other
deprecations are addressed.

@wshanks
Copy link
Collaborator Author

wshanks commented Jan 23, 2024

Note: this PR is marked as a draft because it requires currently unreleased qiskit-ibm-runtime code as noted in Qiskit/qiskit-ibm-runtime#1317.

@wshanks
Copy link
Collaborator Author

wshanks commented Jan 23, 2024

This PR will allow qiskit-experiments tests to keep working against Qiskit 0.45 and main when the fake backends are removed from main. In the future when Qiskit 1.0 is released, I think we might want to switch to using internal test backends that we generate using Qiskit/qiskit#10266 because Qiskit 1.0+ will be more stable than qiskit-ibm-runtime and there would be less chance of updates breaking the tests.

@wshanks
Copy link
Collaborator Author

wshanks commented Jan 25, 2024

qiskit-ibm-runtime 0.18.0 has been released, so this change is usable now. However, currently, we uninstall qiskit-ibm-provider in our tests to run against Qiskit main and the code we are trying to avoid in qiskit-ibm-provider is moving to qiskit-ibm-runtime (see my comment here: Qiskit/qiskit-ibm-runtime#1285 (comment)). If we make qiskit-ibm-runtime a hard test requirement here, we won't be able to do the uninstall trick to avoid it. We could just pin qiskit-ibm-runtime temporarily if that happens, or install it from a patched git branch in the Qiskit main test environment.

@wshanks
Copy link
Collaborator Author

wshanks commented Jan 25, 2024

Rebased on #1375 which should be merged first (unrelated fix to unblock CI).

@wshanks wshanks force-pushed the fakebackends branch 2 times, most recently from b824f6f to 5efeb4a Compare January 26, 2024 02:41
@wshanks wshanks marked this pull request as ready for review January 26, 2024 02:41
The IBM-specific fake backends in Qiskit are being removed in Qiskit 1.0
in Qiskit/qiskit#11376. The same fake backends
have been moved to qiskit-ibm-runtime in
Qiskit/qiskit-ibm-runtime#1140 and follow up
PRs.

Here the `qiskit` imports are replaced with `qiskit-ibm-runtime` imports
in order to provide a smooth transition between Qiskit 0.45 and Qiskit
1.0. In the future, it may be preferable to use generic fake backends
maintained in the repo and not depend on `qiskit-ibm-runtime` for them.

Additionally, this commit reorders the requirements-dev.txt file so it
is easier to read and adds qiskit-ibm-runtime as a development
dependency.
Copy link
Collaborator

@coruscating coruscating left a comment

Choose a reason for hiding this comment

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

This needs to be merged to make CI work again now that 0.46 has been released with a deprecation warning when using fake backends.

@wshanks wshanks enabled auto-merge February 2, 2024 00:59
@wshanks
Copy link
Collaborator Author

wshanks commented Feb 2, 2024

We have to keep an eye on the qiskit-ibm-runtime releases. On the main branch of qiskit-ibm-runtime, the qiskit-ibm-provider code has been merged in including the code incompatible with Qiskit 1.0 that makes us uninstall qiskit-ibm-provider in our Qiskit main tox environment. Probably Qiskit/qiskit-ibm-runtime#1365 will get merged before the next release and it will be compatible with Qiskit 1.0. If there is some other issue though, we won't be able to do the removal trick.

@wshanks
Copy link
Collaborator Author

wshanks commented Feb 2, 2024

Oops, I removed all the place name backends but I didn't realize that FakeBackendV2 was also deprecated in Qiskit.

@wshanks
Copy link
Collaborator Author

wshanks commented Feb 2, 2024

We probably also need #1384? I didn't test my recent change locally.

@coruscating
Copy link
Collaborator

Ah, you're right. Do you want to rebase the changes in #1384 to this PR? They looked fine.

@wshanks
Copy link
Collaborator Author

wshanks commented Feb 2, 2024

I pinned qiskit here and then we can unpin it in #1384.

@wshanks wshanks force-pushed the fakebackends branch 2 times, most recently from 4341be5 to 026f046 Compare February 2, 2024 03:06
@wshanks
Copy link
Collaborator Author

wshanks commented Feb 2, 2024

Hmm, my first pin didn't work...it annoys me how tox hides the output of pip explaining why it is installing what it is installing. I am not sure why qiskit 0.46 still got installed with my first attempt.

@wshanks wshanks added this pull request to the merge queue Feb 2, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 2, 2024
@wshanks wshanks added this pull request to the merge queue Feb 2, 2024
Merged via the queue into qiskit-community:main with commit f22bb7b Feb 2, 2024
11 checks passed
@wshanks wshanks deleted the fakebackends branch February 2, 2024 04:06
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.

2 participants