Pennylane simulator to Quantum Machines

Hi,

I already have an example running well on the Pennylane simulator. How can I execute the same example on a quantum hardware, preferably IBM-Q (which provides 10 minutes of free runtime)?

Can I run it directly, or do I need to transition the code written in Pennylane to another specific platform? Do suggest me some links, if any!

Many thanks in advance.
Ravi

Hi @rkjha!

Nice work getting your example running on simulator. The next step for hardware is to install one of the Pennylane plugins, e.g., the IBM plugin is here. If the plugin is successfully installed, you can change the line qml.device(...) in your code to target the plugin instead of a simulator.

Note that hardware platforms are more intricate than simulators. You have to get yourself access credentials and you have to make sure your program can “fit” into the hardware constraints. As well, they will provide noisy, imperfect answers. You should consult the docs/platform for any hardware you use, as these are external to PennyLane.

1 Like

Hi @nathan,

Thanks for the reply. The devices in the PennyLane Qiskit plugin are currently only compatible with versions of Qiskit below 0.46. However, If I go below Qiskit 0.46, I’d face many issues with Qiskit packages itself for using a hardware.

I guess I need to wait for PennyLane Qiskit plugin to be compatible with Qiskit 1.0!

Hi @rkhja, the plugin should be compatible with Qiskit 1.0. Could you direct us to where you’re encountering issues with non-1.0 compatibility?

Hi @nathan,

I have attached a screenshot of the problem. Hope it clears the way. I could be doing some error possibly as well!

Hi @rkjha, it’s likely you could just have an older version of PL itself. It was a recent release that brought things into feature compatibility with Qiskit 1.0

My recommended next step would be to check the output of qml.about() and make sure you’re upgraded to latest version.

Hi @nathan,

Thanks for your replies. I have updated PL now (v0.35 to v0.38), yet still getting the same error. I am attaching a screenshot once again.

I already have Python 3.9.19 and Qiskit 1.0.2, and now PL 0.38. Is there something missing?

Hi @rkhja, do you also have the latest version of the PL-Qiskit plugin?

You could check the output of qml.about() and compare with latest to confirm

Hi @nathan,

Thanks for the reply. After considering your view on latest versions of the packages, I have installed all latest version of plugin’s in a new environment and it seems working now.

In fact, I also run a tutorial example Using PennyLane with IBM’s quantum devices and Qiskit | PennyLane Demos and the simulator one has worked using Aer_Simulator (‘qiskit.aer’) - except ‘from pennylane_qiskit import qiskit_session’ which did not work, unsure why!

Awesome, glad to hear @rkjha!