diff --git a/qiskit/providers/aer/noise/noise_model.py b/qiskit/providers/aer/noise/noise_model.py index 082ec62e1a..bdbed55143 100644 --- a/qiskit/providers/aer/noise/noise_model.py +++ b/qiskit/providers/aer/noise/noise_model.py @@ -21,7 +21,6 @@ from numpy import ndarray from qiskit.circuit import Instruction, Delay -from qiskit.providers import BaseBackend, BackendV1, BackendV2 from qiskit.providers.exceptions import BackendPropertyError from qiskit.providers.models import BackendProperties from qiskit.transpiler import PassManager @@ -303,10 +302,14 @@ def from_backend(cls, backend, Raises: NoiseError: If the input backend is not valid. """ - if isinstance(backend, BackendV2): + backend_interface_version = getattr(backend, "version", None) + if not isinstance(backend_interface_version, int): + backend_interface_version = 0 + + if backend_interface_version == 2: raise NoiseError( "NoiseModel.from_backend does not currently support V2 Backends.") - if isinstance(backend, (BaseBackend, BackendV1)): + if backend_interface_version <= 1: properties = backend.properties() configuration = backend.configuration() basis_gates = configuration.basis_gates diff --git a/qiskit/providers/aer/pulse/system_models/pulse_system_model.py b/qiskit/providers/aer/pulse/system_models/pulse_system_model.py index 72efc860b0..67a0af9b59 100644 --- a/qiskit/providers/aer/pulse/system_models/pulse_system_model.py +++ b/qiskit/providers/aer/pulse/system_models/pulse_system_model.py @@ -17,7 +17,7 @@ from warnings import warn from collections import OrderedDict -from qiskit.providers import BaseBackend, Backend +from qiskit.providers import Backend from ...aererror import AerError from .hamiltonian_model import HamiltonianModel @@ -94,7 +94,7 @@ def from_backend(cls, backend, subsystem_list=None): AerError: If channel or u_channel_lo are invalid. """ - if not isinstance(backend, (BaseBackend, Backend)): + if not isinstance(backend, Backend): raise AerError("{} is not a Qiskit backend".format(backend)) # get relevant information from backend