Installing Qiskit and Checking the Version
Installing Qiskit and Checking the Version
Install the Qiskit and Qiskit Aer packages in an isolated Python environment, then verify the installed versions programmatically.
Qiskit is an open-source Python package for building quantum circuits, transpiling them, and running them on simulators or on IBM Quantum hardware through a separate cloud service. It is best installed in a Virtual Environment so that its versions do not conflict with other packages:
python -m venv qenv, then activate the environment (source qenv/bin/activate on Linux and macOS or qenv\Scripts\activate on Windows), then pip install qiskit qiskit-aer.
The qiskit package contains circuit construction, the quantum information tools (quantum_info) and the reference primitives (StatevectorSampler and StatevectorEstimator). qiskit-aer is a separate package containing the high-performance simulator AerSimulator and noise models. Since version 1.0 many old interfaces have been removed, such as the execute function, from qiskit import Aer and BasicAer; that is why many examples published before 2024 fail when run today, and the cause is usually the version, not a flaw in the idea.
The example prints the Python version and the versions of the two packages, then checks that Qiskit's major version is at least 1. All the examples in this lab were tested on Qiskit 2.6.2, Qiskit Aer 0.18.4 and PennyLane 0.45.1. If a ModuleNotFoundError appears, the right environment is not activated or the package is not installed in it. Running on real IBM hardware needs an additional package and an account, which is outside the scope of this lesson.
Requirements: pip install qiskit qiskit-aer
Code
import sys
import qiskit
import qiskit_aer
print("Python:", sys.version.split()[0])
print("Qiskit:", qiskit.__version__)
print("Qiskit Aer:", qiskit_aer.__version__)
major = int(qiskit.__version__.split(".")[0])
print("Qiskit >= 1.0:", major >= 1)
Line-by-line explanation of the code
| Line | Explanation |
|---|---|
| 1 | Import the sys module to read the Python interpreter version. |
| 2 | Import Qiskit; if this line succeeds, the package is installed in the current environment. |
| 3 | Import Qiskit Aer (the simulator), a separate package installed with pip install qiskit-aer. |
| 5 | Print only the Python version number (the first part of sys.version). |
| 6-7 | Print the versions of the two packages via the __version__ attribute. |
| 8 | Extract the major version number (e.g. 2 from 2.6.2). |
| 9 | Check that the version is 1.0 or later, a requirement for this lab's examples. |
Output (from an actual run)
Python: 3.13.18 Qiskit: 2.6.2 Qiskit Aer: 0.18.4 Qiskit >= 1.0: True
Run with Python 3.13.18 on 2026-11-20 08:14 UTC.
The numbers vary by environment; the output shown is from the environment in which the examples were tested.
References
- IBM Quantum (2025). Install Qiskit. IBM Quantum Documentation quantum.cloud.ibm.com
- IBM Quantum (2025). Qiskit SDK API documentation. IBM Quantum Documentation quantum.cloud.ibm.com
- Qiskit contributors (2025). Qiskit Aer documentation. GitHub Pages qiskit.github.io
- Ali Javadi-Abhari et al. (2024). Quantum computing with Qiskit. arXiv:2405.08810 doi:10.48550/arXiv.2405.08810
