Reputation: 11
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:\Users\hp\anaconda3\Lib\site-packages\qiskit\__init__.py)
In order to fix this problem, I've been:
---------------------------------------------------------------------------
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:\Users\hp\anaconda3\Lib\site-packages\qiskit_aer\__init__.py)
So at this stage, I don't know how to attack this problem, somebody help me please.
Upvotes: 1
Views: 1400
Reputation: 151
Just do the following,
from qiskit import QuantumCircuit
from qiskit_aer import Aer
Upvotes: 0