Skip to content

Errors in 'migrate from qiskit-ibm-provider' #2982

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

Closed
1 of 5 tasks
SBY13 opened this issue Apr 12, 2025 · 2 comments
Closed
1 of 5 tasks

Errors in 'migrate from qiskit-ibm-provider' #2982

SBY13 opened this issue Apr 12, 2025 · 2 comments

Comments

@SBY13
Copy link

SBY13 commented Apr 12, 2025

URL to the relevant documentation

Migration guides
Section name: Migrate from qiskit_ibm_provider
Paragraph: Example: Basic execution

URL: https://docs.quantum.ibm.com/migration-guides/qiskit-runtime-from-ibm-provider

Select all that apply

  • typo
  • code bug
  • out-of-date content
  • broken link
  • other

Describe the fix.

I have rewritten a program using qiskit-ibm-provider based on the examples in 'migrate from qiskit-ibm-provider'.

I found that the following part in 'Example: Basic execution' causes error.
print(f" > Counts: {result[0].data.meas.get_counts()}")

The error message is

AttributeError: 'DataBin' object has no attribute 'meas'

And this error is resolved by just replacing 'meas' with 'c':
print(f" > Counts: {result[0].data.c.get_counts()}")

In addition, generate_preset_pass_manager also causes errors as in the attached screenshot, but still works. I have no idea how to fix it.

Enviroments: Google colab. Python 3 Google Compute Engine backend
Versions:

  • qiskit-ibm-runtime==0.37.0
  • qiskit==2.0.0
  • qiskit-aer==0.17.0
  • qiskit-ibm-provider==0.11.0

All of the programs related to the error is same with the guides except for quantum circuits.

Image

@SBY13 SBY13 added bug 🐛 content 📄 needs triage 🤔 this issue needs to be prioritized by the docs team labels Apr 12, 2025
@abbycross
Copy link
Collaborator

Related issue: #2650 - may fix this.

TODO: Double-check that Qiskit Runtime has not changed default name of wires

@abbycross abbycross removed the needs triage 🤔 this issue needs to be prioritized by the docs team label Apr 17, 2025
@abbycross abbycross assigned kaelynj and unassigned abbycross and beckykd Apr 17, 2025
@kaelynj
Copy link
Collaborator

kaelynj commented Apr 17, 2025

Hi @SBY13, thanks for opening an issue! I tried recreating the error(s) you were getting but didn't get the errors you specified here. Also if you are still using qiskit-ibm-provider you should remove it from your environment (or at least don't use any of its modules) as that package is no longer supported and has been replaced by qiskit-ibm-runtime.

It's this snippet you are referring to, correct?:

from qiskit import QuantumCircuit
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2 as Sampler
 
service = QiskitRuntimeService()
 
backend = service.least_busy(operational=True, simulator=False, min_num_qubits=127)
 
circuit = QuantumCircuit(2, 2)
circuit.h(0)
circuit.cx(0, 1)
circuit.measure_all()
 
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(circuit)
 
sampler = Sampler(backend)
job = sampler.run([isa_circuit])
result = job.result()
print(f" > Counts: {result[0].data.meas.get_counts()}")

This runs as expected for me in a fresh python environment.

@javabster javabster closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

5 participants