You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for getting in touch! Qiskit recently released version 1.0, and with it came a lot of changes and removals. Upcoming releases of the plugin will be compatible with the new release of Qiskit, but the 0.34 release predates it, and is not. When you pip install qiskit directly, it installs the most recent version of Qiskit.
Once you have Qiskit 1.0 installed in an environment, trying to downgrade can create issues. The best course of action currently in this case is to create a fresh environment, and then pip install pennylane-qiskit directly (without first installing PennyLane and Qiskit). This will install the relevant version Qiskit for using the device.
If you are using PennyLane via a cloud based service, just restart the kernel and pip install the plugin, no need to worry about environments.
import pennylane as qml
from pennylane import numpy as np
Import the PennyLane Qiskit plugin
dev = qml.device('qiskit.aer', wires=2)
Define a PennyLane QNode
@qml.qnode(dev)
def circuit():
qml.Hadamard(wires=0) # Apply Hadamard gate
qml.CNOT(wires=[0, 1]) # Apply CNOT gate
return qml.probs(wires=[0, 1])
Apply depolarizing noise to the CNOT gate
noise_model = qml.transforms.QubitChannelNoiseModel(qml.channels.DepolarizingChannel, wires=1, probability=0.1)
Apply noise model to the CNOT gate
circuit_with_noise = qml.apply(noise_model, circuit)
Execute the circuit
result = circuit_with_noise()
print(result)
is giving the following error
ImportError: cannot import name 'extensions' from 'qiskit' (/usr/local/lib/python3.10/dist-packages/qiskit/init.py)
I have installed:
!pip install qiskit-aer
!pip install pennylane
!pip install pennylane-qiskit
The text was updated successfully, but these errors were encountered: