I wanted to run the following part code in jupyter lab:
from qiskit import QuantumCircuit, Aer
import numpy as np
import qiskit.quantum_info as qi
qc = QuantumCircuit(4,4) # Ponemos 4 qubits y 4 bits
# Aplicamos algunas compuertas
qc.x(0)
qc.y(1)
qc.z(2)
.
.
.
And after I runned the code, I encountered the following error:
ImportError Traceback (most recent call last)
Cell In[5], line 1
----> 1 from qiskit import QuantumCircuit, Aer
2 import numpy as np
3 import qiskit.quantum_info as qi
ImportError: cannot import name 'Aer' from 'qiskit' (C:Usershpanaconda3Libsite-packagesqiskit__init__.py)
In order to fix this problem, I’ve been:
- Reinstalled Qiskit, first putting the command: pip uninstall qiskit and then
pip install qiskit in the Anaconda Prompt. - Upgraded Qiskit, with the following command: pip install –upgrade qiskit.
- Restarted the Jupyter Lab Kernel.
- Checked for conflicting packages, with the following command: pip list. It displayed me a lot of packages I guess, but I coudn´t find the Aer package, Honestly I didn’t understand so well this package list.
- Searched for documentation abut this Aer package, this gave me to this page: https://qiskit.github.io/qiskit-aer/getting_started.html I tried putting the following command in order to install what I understood the Aer package: pip install qiskit-aer.
- Followed the given answer for this similar problem as it was reported in: Qiskit | ImportError: cannot import name ‘Aer’ from ‘qiskit’ Doing so, gave me the next error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[9], line 1
----> 1 from qiskit_aer import QuantumCircuit, Aer
2 import numpy as np
3 import qiskit.quantum_info as qi
ImportError: cannot import name 'QuantumCircuit' from 'qiskit_aer' (C:Usershpanaconda3Libsite-packagesqiskit_aer__init__.py)
So at this stage, I don’t know how to attack this problem, somebody help me please.
New contributor
Simón Xolocotzi Muñoz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.