Pennylane-qiskit connection error

Hi @Ziqi_Wang!

Before answering your question - I just wanted to point out that you shared your IBM token in the above code. You should probably edit your post to remove the token and also go onto the IBM Quantum Experience website and generate a new token. It’s an easy mistake to make, but best not to share the token publicly because others could use it.

It’s great that you managed to get the code working using WSL! Unfortunately I’d say your experience with wait times using remote backends is expected. When running on a local simulator, you are able to evaluate the circuit very quickly, but when using a remote backend you need to send the job, wait for it to go through the queue, wait for it to simulate, and wait for it to come back to you. This can take a single evaluation from fractions of a second to ~1 second. Moreover, the delay will become increasingly noticeable for deep circuits, since calculation of the gradient requires 2 * N_param circuit evalutions.

Some ways you could mitigate this are:

  • Book time on a reservable device, saving you from waiting in the queue
  • Use a shallower circuit (potentially you could use more qubits, i.e., greater width, to compensate)

You could also check out this post for more of a discussion:

Thanks!