MarkCodering / Quantum-Maze-DQN

Deep Q-Learning with Hybrid Quantum Neural Network on Solving Maze Problems
https://link.springer.com/article/10.1007/s42484-023-00137-w
5 stars 0 forks source link

Problems with inporting qiskit.algorithms #1

Open FatemehAghaei opened 8 months ago

FatemehAghaei commented 8 months ago

Hello. Thank you for your good and informative codes. I want to run reinforcement_q_learning_classical file. When I want to run this code:

from qiskit import QuantumCircuit from qiskit.circuit.library import ZZFeatureMap, RealAmplitudes, EfficientSU2, ZFeatureMap from qiskit_machine_learning.neural_networks import EstimatorQNN from qiskit.algorithms.optimizers import COBYLA, L_BFGS_B from qiskit_machine_learning.algorithms.regressors import NeuralNetworkRegressor, VQR from qiskit_machine_learning.connectors import TorchConnector from qiskit.utils import algorithm_globals

I get this error:


ImportError Traceback (most recent call last) in <cell line: 23>() 21 from qiskit.circuit.library import ZZFeatureMap, RealAmplitudes, EfficientSU2, ZFeatureMap 22 from qiskit_machine_learning.neural_networks import EstimatorQNN ---> 23 from qiskit.algorithms.optimizers import COBYLA, L_BFGS_B 24 from qiskit_machine_learning.algorithms.regressors import NeuralNetworkRegressor, VQR 25 from qiskit_machine_learning.connectors import TorchConnector

7 frames /usr/local/lib/python3.10/dist-packages/qiskit/extensions/unitary.py in 22 from qiskit.circuit.exceptions import CircuitError 23 from qiskit.circuit._utils import _compute_control_matrix ---> 24 from qiskit.circuit.quantumcircuit import _qasm_escape_name 25 from qiskit.circuit.library.standard_gates import U3Gate 26 from qiskit.extensions.quantum_initializer import isometry

ImportError: cannot import name '_qasm_escape_name' from 'qiskit.circuit.quantumcircuit' (/usr/local/lib/python3.10/dist-packages/qiskit/circuit/quantumcircuit.py)


NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the "Open Examples" button below.

MarkCodering commented 8 months ago

Hi @FatemehAghaei

Sorry for the confusion. I have reorg the code. Please try src/deep_qlearning_quantum.ipynb this again.

Thanks