Open caleb-johnson opened 8 months ago
Full trace of error:
File "/repos_public_acct/qiskit-ibm-runtime/test.py", line 5, in <module>
print(backend.simulator)
File "/repos_public_acct/qiskit-ibm-runtime/qiskit_ibm_runtime/ibm_backend.py", line 212, in __getattr__
self._convert_to_target()
File "/repos_public_acct/qiskit-ibm-runtime/qiskit_ibm_runtime/ibm_backend.py", line 247, in _convert_to_target
self._target = convert_to_target(
File "/repos_public_acct/qiskit-ibm-runtime/qiskit_ibm_runtime/utils/backend_converter.py", line 118, in convert_to_target
target.add_instruction(name_mapping[name], gate_props)
File "/env/lib/python3.10/site-packages/qiskit/transpiler/target.py", line 424, in add_instruction
raise TranspilerError(
qiskit.transpiler.exceptions.TranspilerError: "The number of qubits for Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]) does not match the number of qubits in the properties dictionary: (0,)"
I can confirm that this issue is reproducible in 0.17.0
:
from qiskit_ibm_runtime import QiskitRuntimeService
service = QiskitRuntimeService()
backend = service.get_backend('simulator_stabilizer')
backend.simulator
---------------------------------------------------------------------------
TranspilerError Traceback (most recent call last)
<ipython-input-21-25450b4bc7bc> in <module>
2 service = QiskitRuntimeService()
3 backend = service.get_backend('simulator_stabilizer')
----> 4 backend.simulator
qiskit_ibm_runtime/ibm_backend.py in __getattr__(self, name)
226 self._get_properties()
227 self._get_defaults()
--> 228 self._convert_to_target()
229 # Check if the attribute now is available on IBMBackend class due to above steps
230 try:
qiskit_ibm_runtime/ibm_backend.py in _convert_to_target(self, refresh)
261 """Converts backend configuration, properties and defaults to Target object"""
262 if refresh or not self._target:
--> 263 self._target = convert_to_target(
264 configuration=self._configuration,
265 properties=self._properties,
qiskit_ibm_runtime/utils/backend_converter.py in convert_to_target(configuration, properties, defaults)
116 gate_len = len(gate.coupling_map[0]) if hasattr(gate, "coupling_map") else 0
117 if name in name_mapping:
--> 118 target.add_instruction(name_mapping[name], gate_props)
119 else:
120 custom_gate = Gate(name, gate_len, [])
qiskit/transpiler/target.py in add_instruction(self, instruction, properties, name)
428 for qarg in properties:
429 if qarg is not None and len(qarg) != instruction.num_qubits:
--> 430 raise TranspilerError(
431 f"The number of qubits for {instruction} does not match the number "
432 f"of qubits in the properties dictionary: {qarg}"
TranspilerError: "The number of qubits for Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]) does not match the number of qubits in the properties dictionary: (0,)"
+1
Describe the bug
simulator_stabilizer
andsimulator_extended_stabilizer
simulator
properties crash the program ungracefully with a cryptic error message.Steps to reproduce
Expected behavior I believe these backends should report
True
, as they are simulators. If these methods can't/shouldn't be implemented, I would expect aNotImplementedError
to be raised.Suggested solutions
Additional Information