Using IBM quantum hardware with PennyLane

Could you please tell how do I run my PennyLane circuit on IBM quantum hardware? Given the recent release of Qiskit 1.0 are there any changes to how to run the hardware?

I need to know ASAP to meet a project deadline.
Thank you so much.

Hi @a_vinil , welcome to the Forum!

We have a new demo coming out soon on how to do this.

You can see the PR here and the preview here.

Remember that you need to install PennyLane and the PennyLane-Qiskit plugin with: pip install pennylane pennylane-qiskit

Here’s a small code example that you can run on IBM hardware:

import warnings

# Add your IBM API token here
# token =

# Import the library that you need in order to use your IBM account
import qiskit_ibm_provider

# Import your favourite libraries
import pennylane as qml
import datetime as dt

# Get your IBM provider
    provider = qiskit_ibm_provider.IBMProvider()
    provider = qiskit_ibm_provider.IBMProvider.save_account(token=token, overwrite=True)


# Define the backend that you will run on
b = "ibm_sherbrooke"

# Create your device
dev = qml.device(
    shots = 1,
#dev = qml.device('qiskit.aer', wires=2)

# Activate the device resource tracker = True

# Create your qnode
def circuit():
    return qml.expval(qml.PauliZ(0))

# Run your circuit

# Retrieve your current job
job = dev._current_job

# Print the summary of job time per step
print('Summary: \n',dev.tracker.history)

I hope this helps and good luck with your project!

1 Like

Thank you so much Catalina.

No problem @a_vinil !

Let us know if you have any issues with running on their hardware.