$ python -m unittest test/aqua/operators/legacy/test_weighted_pauli_operator.py
/Users/ima/tasks/1_2021/qiskit/aqua/test/aqua/operators/legacy/test_weighted_pauli_operator.py:41: DeprecationWarning: `from_label` is deprecated and will be removed no earlier than 3 months after the release date. Use Pauli(label) instead.
paulis = [Pauli.from_label(pauli_label)
....(12.06s)
.../Users/ima/tasks/1_2021/qiskit/aqua/qiskit/aqua/operators/legacy/op_converter.py:122: DeprecationWarning: `to_spmatrix` is deprecated and will be removed no earlier than 3 months after the release date. Use `to_matrix(sparse=True)` instead.
hamiltonian += weight * pauli.to_spmatrix()
.E/Users/ima/tasks/1_2021/qiskit/aqua/qiskit/aqua/components/initial_states/custom.py:79: DeprecationWarning: The Custom class is deprecated as of Aqua 0.9 and will be removed no earlier than 3 months after the release date. Instead, all algorithms and circuits accept a plain QuantumCircuit. Custom(state_vector=vector) is the same as a circuit where the ``initialize(vector/np.linalg.norm(vector))`` method has been called.
super().__init__()
/Users/ima/tasks/1_2021/qiskit/aqua/qiskit/aqua/components/initial_states/custom.py:151: DeprecationWarning: The StateVectorCircuit class is deprecated as of Qiskit Aqua 0.9.0 and will be removed no earlier than 3 months after the release. If you need to initialize a circuit, use the QuantumCircuit.initialize or QuantumCircuit.isometry methods. For a parameterized initialization, try the qiskit.ml.circuit.library.RawFeatureVector class.
svc = StateVectorCircuit(self._state_vector)
./Users/ima/tasks/1_2021/qiskit/aqua/qiskit/aqua/components/initial_states/custom.py:79: DeprecationWarning: The Custom class is deprecated as of Aqua 0.9 and will be removed no earlier than 3 months after the release date. Instead, all algorithms and circuits accept a plain QuantumCircuit. Custom(state_vector=vector) is the same as a circuit where the ``initialize(vector/np.linalg.norm(vector))`` method has been called.
super().__init__()
/Users/ima/tasks/1_2021/qiskit/aqua/qiskit/aqua/components/initial_states/custom.py:151: DeprecationWarning: The StateVectorCircuit class is deprecated as of Qiskit Aqua 0.9.0 and will be removed no earlier than 3 months after the release. If you need to initialize a circuit, use the QuantumCircuit.initialize or QuantumCircuit.isometry methods. For a parameterized initialization, try the qiskit.ml.circuit.library.RawFeatureVector class.
svc = StateVectorCircuit(self._state_vector)
(25.71s)
...../Users/ima/tasks/1_2021/qiskit/aqua/qiskit/aqua/operators/legacy/weighted_pauli_operator.py:287: DeprecationWarning: sgn_prod is deprecated and will be removed no earlier than 3 months after the release date. Use `dot` instead.
new_pauli, sign = Pauli.sgn_prod(existed_pauli, pauli)
..Operator is empty, Return 0.
....../Users/ima/tasks/1_2021/qiskit/terra/qiskit/quantum_info/operators/symplectic/pauli.py:185: DeprecationWarning: Initializing Pauli from `Pauli(z=z, x=x)` kwargs is deprecated as of version 0.17.0 and will be removed no earlier than 3 months after the release date. Use tuple initialization `Pauli((z, x))` instead.
base_z, base_x, base_phase = self._from_array_deprecated(z, x)
/Users/ima/tasks/1_2021/qiskit/aqua/qiskit/aqua/operators/primitive_ops/pauli_op.py:107: DeprecationWarning: `kron` is deprecated and will be removed no earlier than 3 months after the release date of Qiskit Terra 0.17.0. Use `expand` instead, but note this does not change the operator in-place.
return PauliOp(op_copy.kron(self.primitive), coeff=self.coeff * other.coeff)
.
======================================================================
ERROR: test_evaluate_with_aer_mode (test.aqua.operators.legacy.test_weighted_pauli_operator.TestWeightedPauliOperator)
evaluate with aer mode test
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/ima/tasks/1_2021/qiskit/aqua/test/aqua/operators/legacy/test_weighted_pauli_operator.py", line 521, in test_evaluate_with_aer_mode
result=quantum_instance_statevector.execute(circuits),
File "/Users/ima/tasks/1_2021/qiskit/aqua/qiskit/aqua/quantum_instance.py", line 301, in execute
circuits = self.transpile(circuits)
File "/Users/ima/tasks/1_2021/qiskit/aqua/qiskit/aqua/quantum_instance.py", line 257, in transpile
transpiled_circuits = compiler.transpile(circuits,
File "/Users/ima/tasks/1_2021/qiskit/terra/qiskit/compiler/transpiler.py", line 242, in transpile
circuits = parallel_map(_transpile_circuit, list(zip(circuits, transpile_args)))
File "/Users/ima/tasks/1_2021/qiskit/terra/qiskit/tools/parallel.py", line 112, in parallel_map
return [task(values[0], *task_args, **task_kwargs)]
File "/Users/ima/tasks/1_2021/qiskit/terra/qiskit/compiler/transpiler.py", line 325, in _transpile_circuit
result = pass_manager.run(circuit, callback=transpile_config['callback'],
File "/Users/ima/tasks/1_2021/qiskit/terra/qiskit/transpiler/passmanager.py", line 215, in run
return self._run_single_circuit(circuits, output_name, callback)
File "/Users/ima/tasks/1_2021/qiskit/terra/qiskit/transpiler/passmanager.py", line 276, in _run_single_circuit
result = running_passmanager.run(circuit, output_name=output_name, callback=callback)
File "/Users/ima/tasks/1_2021/qiskit/terra/qiskit/transpiler/runningpassmanager.py", line 122, in run
dag = self._do_pass(pass_, dag, passset.options)
File "/Users/ima/tasks/1_2021/qiskit/terra/qiskit/transpiler/runningpassmanager.py", line 153, in _do_pass
dag = self._run_this_pass(pass_, dag)
File "/Users/ima/tasks/1_2021/qiskit/terra/qiskit/transpiler/runningpassmanager.py", line 165, in _run_this_pass
new_dag = pass_.run(dag)
File "/Users/ima/tasks/1_2021/qiskit/terra/qiskit/transpiler/passes/basis/unroll_custom_definitions.py", line 87, in run
raise QiskitError("Cannot unroll the circuit to the given basis, %s. "
qiskit.exceptions.QiskitError: "Cannot unroll the circuit to the given basis, ['u1', 'u2', 'u3', 'u', 'p', 'r', 'rx', 'ry', 'rz', 'id', 'x', 'y', 'z', 'h', 's', 'sdg', 'sx', 't', 'tdg', 'swap', 'cx', 'cy', 'cz', 'csx', 'cp', 'cu1', 'cu2', 'cu3', 'rxx', 'ryy', 'rzz', 'rzx', 'ccx', 'cswap', 'mcx', 'mcy', 'mcz', 'mcsx', 'mcp', 'mcu1', 'mcu2', 'mcu3', 'mcrx', 'mcry', 'mcrz', 'mcr', 'mcswap', 'unitary', 'diagonal', 'multiplexer', 'initialize', 'kraus', 'roerror', 'delay']. Instruction snapshot not found in equivalence library and no rule found to expand."
----------------------------------------------------------------------
Ran 24 tests in 40.006s
FAILED (errors=1)
Information
What is the current behavior?
test_weighted_pauli_operator.py fails because transpiler does not unroll
snapshot
instruction now. It may be caused by https://github.com/Qiskit/qiskit-terra/pull/5701Steps to reproduce the problem
What is the expected behavior?
pass the test.
Suggested solutions