mapomatic icon indicating copy to clipboard operation
mapomatic copied to clipboard

Qiskit 2.0 incompability in layouts.py

Open mjlp123 opened this issue 9 months ago • 1 comments

Hi, With the new qiskit 2.0 release, an error is thrown when importing this repo. I noticed that the error comes from an old import of BackendV1 from qiskit.providers.backend, which is no longer supported. Here is the error thrown, as well as a potential fix (remove dependencies on BackendV1).

Error in /mapomatic/layouts.py:35: ` 35 from qiskit.providers.backend import BackendV1, BackendV2 38 def matching_layouts(circ, cmap, strict_direction=True, call_limit=int(3e7)): 39 """Matching for a circuit onto a given topology (coupling map) 40 41 Parameters: (...) 51 TypeError: Invalid type passed to cmap 52 """

ImportError: cannot import name 'BackendV1' from 'qiskit.providers.backend' (/Users/mlozano/Desktop/notebooks/venv/lib/python3.11/site-packages/qiskit/providers/backend.py)`

Potential fix (remove any dependencies on BackendV1):

from qiskit.providers.backend import BackendV2

Hope this helps, thanks!

mjlp123 avatar Apr 24 '25 16:04 mjlp123

Many thanks for highlighting this. It should be fixed when #77 is merged.

nonhermitian avatar May 19 '25 17:05 nonhermitian