Hi,
I am trying to experiment on pennylane-qiskit . But it gives me error. I have posted the code and error. Please help.
Code:
import pennylane as qml
dev = qml.device(‘qiskit.ibmq’, wires=2, backend=‘ibmq_16_melbourne’)
@qml.qnode (dev)
def circuit(x, y, z):
qml.RZ(z, wires=[0])
qml.RY(y, wires=[0])
qml.RX(x, wires=[0])
qml.CNOT(wires=[0, 1])
return qml.expval(qml.PauliZ(wires=1))
circuit(0.2, 0.1, 0.3)
Error:
File “/usr/local/lib/python3.6/dist-packages/pennylane_qiskit/qiskit_device.py”, line 231, in run
self._current_job = self.backend.run(qobj, backend_options=self.kwargs)
TypeError: run() got an unexpected keyword argument ‘backend_options’
josh
September 10, 2019, 1:58pm
2
Hi @avinash_ch !
We’ve just released a new version of the Qiskit plugin, as well as a new version of PennyLane.
Could you try updating your installations, and see if that fixes the issue?
pip install pennylane pennylane-qiskit -U
If not, then we will troubleshoot through the issue
Dear @josh ,
I have tried the same updating both pennylane and pennylane-qiskit.
It is giving the same error.
File “/usr/local/lib/python3.6/dist-packages/PennyLane_qiskit-0.6.0.dev0-py3.6.egg/pennylane_qiskit/qiskit_device.py”, line 231, in run
self._current_job = self.backend.run(qobj, backend_options=self.kwargs)
TypeError: run() got an unexpected keyword argument 'backend_options’
Please look into this.
Thanks in advance.
josh
September 13, 2019, 6:42pm
5
Thanks @avinash_ch , I’ll have a look into this!
josh
September 13, 2019, 9:56pm
6
@avinash_ch , I’ve found the bug, and made a pull request to fix it:
PennyLaneAI:master
← PennyLaneAI:fix_ibmq_backend_options
opened 09:32PM - 13 Sep 19 UTC
**Context**: The current `QiskitDevice` assumes that all backends accept backend… options, but this isn't the case --- hardware backends on IBMQ do not accept backend options. This leads to an `TypeError` for hardware-bound jobs.
**Description of change:**
* `inspect.signature` is used to determine what keyword arguments the backend supports.
* A new attribute `self.run_args` is now used to correctly store a dictionary of allowed keyword arguments.
* Version number incrementation for a minor bugfix release.
**Benefits:** Fixes the bug
**GitHub Issues**: https://discuss.pennylane.ai/t/pennylane-qiskit-error/204
Once it has been merged in, I will release a new version of the plugin.
In the meantime, you can install the fixed version of the plugin here:
pip install git+https://github.com/XanaduAI/pennylane-qiskit.git@fix_ibmq_backend_options
josh
September 14, 2019, 1:39am
7
Hi @avinash_ch ; PennyLane-Qiskit has now been updated, so you can simply do
pip install pennylane-qiskit --upgrade
to get the version with the bugfix!
Thank you @josh for your prompt response. it is working now.
I will continue experimenting.
1 Like