I am trying to run the quantum communication algorithm from qiskit textbook "Entangled States" using my IBM API key, however, it throws the error RuntimeError: IBMBackend.run() is not supported in the Qiskit Runtime environment.
. What am I doing wrong? This is my code:
service = QiskitRuntimeService(channel="ibm_quantum", token=[REDACTED API KEY])
backend = service.least_busy(simulator=False, operational=True)
print(f'Running on {backend}')
qc_charlie = QuantumCircuit(2,2)
qc_charlie.h(1)
qc_charlie.cx(1,0)
MESSAGE = '01'
qc_alice = QuantumCircuit(2,2)
if MESSAGE[-2]=='1':
qc_alice.z(1)
if MESSAGE[-1]=='1':
qc_alice.x(1)
qc_bob = QuantumCircuit(2,2)
# Bob disentangles
qc_bob.cx(1,0)
qc_bob.h(1)
# Then measures
qc_bob.measure([0,1],[0,1])
complete_qc = qc_charlie.compose(qc_alice.compose(qc_bob))
backend.run(complete_qc).result().get_counts()
I know the API works since I get Running on <IBMBackend('ibmq_belem')>
and the circuit is ok as i can see it using qc_charlie.draw()
, qc_alice.draw()
and qc_bob.draw()
.