pythongoogle-colaboratoryqiskit

Colab Google using qiskit Aer


Here is my code:

#!pip3 install qiskit
!pip3 install qiskit-aer
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister

This is the Error I get:

ImportError                               Traceback (most recent call last)

<ipython-input-14-2acb4a3b8d5d> in <cell line: 4>()
      2 !pip3 install qiskit
      3 get_ipython().system('pip3 install qiskit-aer')
----> 4 from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister
      5 
      6 # Load training data

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

I use Google Colab. I also used the following:

!pip3 install qiskit
and !pip install qiskit

And I got the same error.


Solution

  • Aer is no longer part of Qiskit. In order to use the Aer module, you should install the qiskit_aer package with

    pip install qiskit-aer
    

    (see qiskit aer getting started)

    Once installed, you can import the Aer module directly from qiskit_aer using

    from qiskit_aer import Aer