sQUlearn / squlearn

scikit-learn interface for quantum algorithms
https://squlearn.github.io
Apache License 2.0
63 stars 20 forks source link

Upgrade to Qiskit Runtime V2 primitives #297

Closed samoils closed 1 month ago

samoils commented 1 month ago

Describe the bug Current version of the library does not run on the IBM Quantum service due to the deprecation and removal of support for V1 primitives as of August 15th, 2024. Jobs being run in a session fail with the following error:

The V1 Primitives SamplerV1 and EstimatorV1 are no longer supported. Refer to the migration guide for instructions on migrating to V2 primitives: https://docs.quantum.ibm.com/migration-guides/v2-primitives. -- Use a supported version of the primitive. See the Qiskit Runtime release notes <https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/release-notes>__ to learn what is supported. -- https://ibm.biz/error_codes#1513

See also: https://docs.quantum.ibm.com/migration-guides/v2-primitives

To Reproduce Run a session on IBM Quantum that requires the Estimator or Sampler classes (e.g. the Bayesian optimization example).

Expected behavior Jobs submitted in a session created on the IBM Quantum service should run and complete successfully without the error about the V1 primitive.

Additional context Tested on the latest development branch and the release branch and issue is reproducible in both.

David-Kreplin commented 1 month ago

Hallo samoils, thank you very much for pointing out! Since we have currently fixed qiskits version below 1.1.0, this has not been caputed by our tests. We will fix this ASAP.

David-Kreplin commented 1 month ago

We are working on this in Draft #298

The recent changes in Qiskit have been somewhat abrupt, particularly with the deprecation of the older primitives. Some other packages have also not been updated yet, so Fidelity Kernels might not work after we fix everything in sQUlearn. We are optimistic that a new release will be ready by mid-next week.

samoils commented 4 weeks ago

Just tested the fix and it works great and submits correctly to IBM Quantum. Thanks for fixing it!