ImportError: cannot import name 'adjoint_diff' from 'pennylane_lightning.lightning_qubit_ops'

67 # check if cpp library for gradient computation exists
68 try:
—> 69 from pennylane_lightning.lightning_qubit_ops import (
70 adjoint_diff,
71 StateVectorC64,

ImportError: cannot import name ‘adjoint_diff’ from ‘pennylane_lightning.lightning_qubit_ops’ (/usr/local/lib/python3.10/dist-packages/pennylane_lightning/lightning_qubit_ops.cpython-310-x86_64-linux-gnu.so)

Thank you.

Hello @David_Liu,
Adjoint differentiation is typically applied with qnode decorators such as @qml.qnode(dev, diff_method=“adjoint”). Could you provide more detail of where you would like to apply adjoint in the code?

Reference:

Hi @David_Liu

Can you provide the output of qml.about()? Also, if you have a minimum working script that reproduces the error this can help us identify the cause of the issue.

I suspect this may be a version mismatch, and if so you can ensure your version of PennyLane and lightning.gpu are at the same version with python -m pip install pennylane pennylane-lightning-gpu --upgrade.

1 Like

Thanks. It was a version mismatch between PennyLane and lightning.gpu from a library package.

Problem solved. It was a version mismatch between PennyLane and lightning.gpu from a library package.

Thank you for letting us know that this solved your issue @David_Liu !

We have a new PennyLane survey. We would love to know your thoughts about PennyLane in order to keep bringing you amazing features :sparkles:.