Closed iuliazidaru closed 2 years ago
from qiskit import QuantumCircuit
from qiskit_ibm_runtime import QiskitRuntimeService
service = QiskitRuntimeService()
backend = "ibmq_qasm_simulator"
# List all available programs.
service.pprint_programs()
# Create a circuit.
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
# Set the "sampler" program parameters
params = service.program(program_id="sampler").parameters()
params.circuits = qc
# Configure backend options
options = {'backend_name': backend}
# Execute the circuit using the "sampler" program.
job = service.run(program_id="sampler",
options=options,
inputs=params)
# Get runtime job result.
result = job.result()
Describe the bug Example in file throws an error: https://github.com/Qiskit/qiskit-ibm-runtime/blob/main/qiskit_ibm_runtime/qiskit_runtime_service.py IBMInputValueError: 'Param (circuit_indices) missing required value!'
Steps to reproduce Copy the example in quantum-computing.ibm.com after QiskitRuntime account is saved.
Expected behavior Code works.
Suggested solutions add params.circuit_indices = 0 or make circuit_indices parameter optional as it is not needed when a single circuit is provided.
Additional Information When adding circuit_indices I get:
UserWarning: The qiskit version used to generate the provided QPY file, 0.20.0, is newer than the current qiskit version 0.19.2.
TypeError: main() got an unexpected keyword argument \'_ParameterNamespace__metadata\'\n'