Open PariaNaghavi opened 1 year ago
Hi @PariaNaghavi
Sorry for the delay.
Two points:
pyqir
. This means that the importation in qir.py
needs to be updated according. Use from pyqir import ...
for everything (https://www.qir-alliance.org/pyqir/upgrade.html#pyqir-0-7). You kind of already solved this problem.from qutip.qip.circuit import QubitCircuit, Measurement, Gate
. You are mixing the new package qutip_qip
and the old module in the qutip main package qutip.qip
. Although they share many similarities. They are not the same. Because you imported Gate
from qutip.qip
. They code in qir.py
cannot recognize it. Please use from qutip_qip.circuit import QubitCircuit, Measurement, Gate
instead.@cgranade Is it ok to drop the support of 0.6
and only support 0.7
? Or should we try to keep it working both for 0.7
and 0.6
? It seems quite cumbersome to support both because it is not just a change of version but rather the packages pyqir-generator
and pyqir-parser
are replaced by pyqir
.
Thank you @BoxiLi.
from pyqir import generator
works, I can not import the parser by from pyqir import parser
. Please see the issue.qutip_qip.circuit
. I could try that on the qir.py
file, once the parser is importable. With these changes (https://github.com/BoxiLi/qutip-qip/commit/d24b7b6c60a680644ec0f10dc775373bde1f2788) on qir.py
and replacing qutip.qip
with qutip_qip
. I'm able to run through most of your ipynb
.
Thank you for the updates to the file.
When I attempted to execute the updated qir.py
file, I encountered an import error for Measurement
from qutip_qip.operations
. Any hints on how I can resolve this?
You might be using an old version of the source code, not the one on the current master branch?
You can try
from qutip_qip.circuit import Measurement, Gate
.
It works. Thank you!
Just a gentle follow up, would you consider pushing the changes in qir.py
on main?
Yes, will soon make a PR on that.
@cgranade Hi, could you maybe help us get the test updated for the new pyqir
? I can get the code to work in (https://github.com/BoxiLi/qutip-qip/commit/d24b7b6c60a680644ec0f10dc775373bde1f2788) but have quite some difficulties updating the tests. It seems that the whole test file needs to be restructured because of the new interface?
Next, I adjusted the code to use the
pyqir-generator
instead of the parser, but I reached the following error about SNOT gate “not implemented in the QIR base profile and may require a custom declaration".To replicate: Please see here Current outcome: An error due to missing
.qir
attribute andcircuit_to_qir
function in qutip-qip version and the missing dependencypyqir.parser
Expected outcome: To generate qir, as shown in docs Notes: I would appreciate any suggestions or insights that might help in addressing these issues. Please let me know if there is any additional information or assistance that I can provide to fix this issue. Environment: QuTiP-QIP version: 0.0.3 pyqir version: 0.7.0 Python version: 3.9Originally posted by @PariaNaghavi in https://github.com/qutip/qutip-qip/issues/125#issuecomment-1382605820