QuantumVolume QASM circuit error
See original GitHub issueInformation
- Qiskit Terra version:
qiskit-terra==0.18.1
- Python version:
3.7.3
- Operating system:
macOS Mojave
What is the current behavior?
The method QuantumVolume
at qiskit.circuit.library.quantum_volume
can be used to generate quantum volume circuits. Some of the circuits generated by this method throw an error when they are saved as a QASM file, and then read in using QuantumCircuit.from_qasm_file(path)
Steps to reproduce the problem
This circuit:
was generated using the qiskit.circuit.library.quantum_volume
method. When I run this code:
from qiskit import QuantumCircuit
qc = QuantumCircuit.from_qasm_file("qasm_error_circuit.txt")
I get the error
qc = QuantumCircuit.from_qasm_file("qasm_error_circuit.txt")
File "//anaconda3/lib/python3.7/site-packages/qiskit/circuit/quantumcircuit.py", line 1900, in from_qasm_file
return _circuit_from_qasm(qasm)
File "//anaconda3/lib/python3.7/site-packages/qiskit/circuit/quantumcircuit.py", line 2733, in _circuit_from_qasm
ast = qasm.parse()
File "//anaconda3/lib/python3.7/site-packages/qiskit/qasm/qasm.py", line 54, in parse
return qasm_p.parse(self._data)
File "//anaconda3/lib/python3.7/site-packages/qiskit/qasm/qasmparser.py", line 1070, in parse
self.parser.parse(data, lexer=self.lexer, debug=self.parse_deb)
File "//anaconda3/lib/python3.7/site-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "//anaconda3/lib/python3.7/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
p.callable(pslice)
File "//anaconda3/lib/python3.7/site-packages/qiskit/qasm/qasmparser.py", line 525, in p_gate_decl_0
self.update_symtab(program[0])
File "//anaconda3/lib/python3.7/site-packages/qiskit/qasm/qasmparser.py", line 77, in update_symtab
str(prev.line) + ', file', prev.file)
qiskit.qasm.exceptions.QasmError: "Duplicate declaration for gate 'su4_976' at line 88, file qasm_error_circuit.txt.\nPrevious occurrence at line 18, file qasm_error_circuit.txt"
What is the expected behavior?
Suggested solutions
Naming each su4 declaration with additional unique numbers so there are no duplicates.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
QasmError when parsing quantum volume qc.qasm() #3066
If you pass a quantum volume circuit's qc.qasm() into qc.from_qasm_str, which calls qiskit's qasm parser, throws a QasmError. The same error ...
Read more >API error codes - IBM Quantum
Split the circuits in smaller jobs. 1002. Error in the ... Error during the validation process of a job. Retry the action. ......
Read more >Re-examining the quantum volume test: Ideal distributions ...
The quantum volume test is a full- system benchmark for quantum comput- ers that is sensitive to qubit number, fi- delity, connectivity, and...
Read more >qiskit - QV circuits fail to execute in real devices
IBMQBackend.run() method now takes one or more QuantumCircuit or Schedule . Use of QasmQobj and PulseQobj is now deprecated.
Read more >What Is Quantum Volume, Anyway? - Medium
You use the qasm simulator to determine what the heavy outputs are. You run the circuit again on a quantum computer (or a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jakelishman Yes, that is the problem. According to pip I have
qiskit-terra==0.18.1
installed, but the actual version I am using is0.17.0
:Ah, that’s good to know! Thanks - bugs are always super scary when we can’t reproduce them, so good to know the cause in the end.
In general,
conda
andpip
play a little weirdly together. When you’re using packages from both at once,conda list
is typically a little more reliable thanpip list
, becauseconda
knows how to readpip
’s status, but it doesn’t really work the other way around.