Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with inporting qiskit.algorithms #1

Open
FatemehAghaei opened this issue Feb 28, 2024 · 1 comment
Open

Problems with inporting qiskit.algorithms #1

FatemehAghaei opened this issue Feb 28, 2024 · 1 comment

Comments

@FatemehAghaei
Copy link

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
Copy link
Owner

Hi @FatemehAghaei

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

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants