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

Error in "Repeat until success" tutorial #1385

Closed
frankharkins opened this issue May 15, 2024 · 2 comments
Closed

Error in "Repeat until success" tutorial #1385

frankharkins opened this issue May 15, 2024 · 2 comments

Comments

@frankharkins
Copy link
Member

frankharkins commented May 15, 2024

The following code cell raises an error. It's not clear this ever worked.

sampler = Sampler(backend)
job = sampler.run([isa_circuit])

simulator_counts = job.result()[0]
print(f">>> Simulator counts for mid: {simulator_counts.data.mid.get_counts()}")
print(f">>> Simulator counts for final: {simulator_counts.data.final.get_counts()}")
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[8], line 1
----> 1 sampler = Sampler(backend)
      2 job = sampler.run([isa_circuit])
      4 simulator_counts = job.result()[0]

File /usr/local/lib/python3.11/site-packages/qiskit_ibm_runtime/sampler.py:92, in SamplerV2.__init__(self, backend, session, options)
     90 BaseSamplerV2.__init__(self)
     91 Sampler.__init__(self)
---> 92 BasePrimitiveV2.__init__(self, backend=backend, session=session, options=options)
     94 if self._service._channel_strategy == "q-ctrl":
     95     raise NotImplementedError("SamplerV2 is not supported with q-ctrl channel strategy.")

File /usr/local/lib/python3.11/site-packages/qiskit_ibm_runtime/base_primitive.py:121, in BasePrimitiveV2.__init__(self, backend, session, options)
    115 self._service = (
    116     QiskitRuntimeService()
    117     if QiskitRuntimeService.global_service is None
    118     else QiskitRuntimeService.global_service
    119 )
    120 if self._service.channel != "ibm_cloud":
--> 121     raise ValueError(
    122         "A backend or session must be specified when not using ibm_cloud channel."
    123     )

ValueError: A backend or session must be specified when not using ibm_cloud channel.
@frankharkins
Copy link
Member Author

@frankharkins
Copy link
Member Author

It seems to only be a problem with the mock backend. I've marked it as "unmockable" in #1391. This is fine for now as its future is uncertain (see #1309). If we do revamp the notebook, we can look into this then.

@frankharkins frankharkins closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

1 participant