Error with qiskit noise-model

Hi, I am using the following code to simulate a circuit with noise model from a qiskit device, but I get the following error.

from qiskit_ibm_provider import IBMProvider
from qiskit_aer.noise import NoiseModel

import pennylane as qml
provider = IBMProvider(token='YOUR_TOKEN')
backend = provider.get_backend('ibm_sherbrooke')
noise_model = NoiseModel.from_backend(backend)

devNoisy = qml.device('qiskit.aer', wires=2, noise_model = noise_model)
def circNoisy():

   return qml.expval(qml.PauliZ(wires=0))


Here is the error message-

json_decoder.target_from_server_data:WARNING:2024-07-10 21:01:05,971: Definition of instruction switch_case is not found in the Qiskit namespace and GateConfig is not provided by the BackendConfiguration payload. Qiskit Gate model cannot be instantiated for this instruction and this instruction is silently excluded from the Target. Please add new gate class to Qiskit or provide GateConfig for this name.
Traceback (most recent call last):
  File "/home/sreetamadas/Downloads/QCNN-main/symmetric_QCNN/Equivariant_QCNN_correct/", line 32, in <module>
    devNoisy = qml.device('qiskit.aer', wires=2, noise_model = noise_model)
  File "/home/sreetamadas/anaconda3/lib/python3.10/site-packages/pennylane/", line 402, in device
    plugin_device_class = plugin_devices[name].load()
  File "/home/sreetamadas/anaconda3/lib/python3.10/importlib/metadata/", line 171, in load
    module = import_module('module'))
  File "/home/sreetamadas/anaconda3/lib/python3.10/importlib/", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/sreetamadas/anaconda3/lib/python3.10/site-packages/pennylane_qiskit/", line 17, in <module>
    from .aer import AerDevice
  File "/home/sreetamadas/anaconda3/lib/python3.10/site-packages/pennylane_qiskit/", line 21, in <module>
    from .qiskit_device import QiskitDevice
  File "/home/sreetamadas/anaconda3/lib/python3.10/site-packages/pennylane_qiskit/", line 58, in <module>
    "QubitStateVector": lib.Initialize,
AttributeError: module 'qiskit.circuit.library' has no attribute 'Initialize'

I am using pennylane and the qiskit plugin in version 0.37

Hi @sdas,

I’m running your code on Google Colab and get no issues. I’m guessing there’s probably an incompatible combination of PennyLane, Qiskit, and the PennyLane-Qiskit plugin.

What is your output for qml.about()? And your Qiskit version?

import qiskit

You might need to run python -m pip install pennylane pennylane-qiskit --upgrade to make sure you’re running version v0.37 of PennyLane and the plugin, and version 1.1.1 of Qiskit.

Let me know if this solves your issue!

Note: you’ll probably get a deprecation warning saying that you need to change your code in the future. Something like the following might help you fix that.

from qiskit_ibm_runtime import QiskitRuntimeService
# IBM Quantum channel; set to default
QiskitRuntimeService.save_account(channel="ibm_quantum", token="<IQP_TOKEN>")