Skip to content

TranspilerError: "The number of qubits for Instruction(name='cx', ...) does not match the number of qubits in the properties dictionary: (0,)" #1298

Open
@antalszava

Description

@antalszava

Information

  • qiskit-ibm-provider version: qiskit-ibm-provider==0.5.2
  • Python version: 3.11
  • Operating system: Ubuntu

What is the current behavior?

When switching from qiskit.IBMQ to IBMProvider as the deprecation message notes an error arises during execution. This can be reproduced simply by querying the target of the obtained backend.

The error:

---------------------------------------------------------------------------
TranspilerError                           Traceback (most recent call last)
Cell In[2], line 35
     32 # ibmq_manhattan supports mid-circuit measurements
     33 backend = provider.get_backend(backend_name)
---> 35 backend.target

File ~/anaconda3/envs/someenv/lib/python3.11/site-packages/qiskit_ibm_provider/ibm_backend.py:329, in IBMBackend.target(self)
    327 self._get_properties()
    328 self._get_defaults()
--> 329 self._convert_to_target()
    330 return self._target

File ~/anaconda3/envs/someenv/lib/python3.11/site-packages/qiskit_ibm_provider/ibm_backend.py:284, in IBMBackend._convert_to_target(self)
    282 """Converts backend configuration, properties and defaults to Target object"""
    283 if not self._target:
--> 284     self._target = convert_to_target(
    285         configuration=self._configuration,
    286         properties=self._properties,
    287         defaults=self._defaults,
    288     )

File ~/anaconda3/envs/someenv/lib/python3.11/site-packages/qiskit_ibm_provider/utils/backend_converter.py:120, in convert_to_target(configuration, properties, defaults)
    118 gate_len = len(gate.coupling_map[0]) if hasattr(gate, "coupling_map") else 0
    119 if name in name_mapping:
--> 120     target.add_instruction(name_mapping[name], gate_props)
    121 else:
    122     custom_gate = Gate(name, gate_len, [])

File ~/anaconda3/envs/someenv/lib/python3.11/site-packages/qiskit/transpiler/target.py:381, in Target.add_instruction(self, instruction, properties, name)
    379 for qarg in properties:
    380     if qarg is not None and len(qarg) != instruction.num_qubits:
--> 381         raise TranspilerError(
    382             f"The number of qubits for {instruction} does not match the number "
    383             f"of qubits in the properties dictionary: {qarg}"
    384         )
    385     if qarg is not None:
    386         self.num_qubits = max(self.num_qubits, max(qarg) + 1)

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,)"

Steps to reproduce the problem

from qiskit_ibm_provider import IBMProvider
backend_name = 'simulator_extended_stabilizer'
provider = IBMProvider(token='<Token here>')

# ibmq_manhattan supports mid-circuit measurements
backend = provider.get_backend(backend_name)
backend.target

What is the expected behavior?

No error.

Suggested solutions

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingserver actionNeed actions from the server side

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions