Install the Qiskit SDK from source
When you install the Qiskit SDK from source, you can access the current development version, instead of using the version in the Python Package Index (PyPI) repository. You can therefore inspect and extend the latest version of the Qiskit code more efficiently.
Create and activate a new virtual environment
-
Navigate to your project directory and create a minimal environment with only Python installed in it.
python3 -m venv .venvpython3 -m venv .venvpython -m venv .venv -
Activate your new environment.
source .venv/bin/activatesource .venv/bin/activate.venv\Scripts\Activate.ps1
Install the Rust compiler
A Rust compiler must be installed on your system to compile Qiskit. To install the Rust compiler, use the cross-platform Rust installer rustup or another install method.
Install Qiskit
Follow these steps to install Qiskit:
- Clone the Qiskit repository.
git clone https://github.com/Qiskit/qiskit.git- Change to the
qiskitdirectory.
cd qiskit- (Optional) If you want to run tests or linting checks, install the developer requirements.
pip install -r requirements-dev.txt- Install
qiskit.
-
Standard install:
pip install . -
Editable mode: In this mode, you don't need to reinstall Qiskit when there are code changes to the project.
pip install -e .In editable mode, the compiled extensions are built in debug mode without optimizations. This affects the runtime performance of the compiled code. To build the compiled extensions with optimizations enabled, run the following command to rebuild the binary in release mode:
python setup.py build_rust --release --inplaceNoteIf you are working on Rust code in Qiskit, you need to rebuild the extension code every time you make a local change. In editable mode, the Rust extension is only built when the install command is run, so local changes you make to the Rust code are not reflected in the installed package unless you rebuild the extension by rerunning
build_rust(with or without--release, depending on whether you want to build in release or debug mode).
Next steps
- Read the contributing guidelines to contribute to the open-source Qiskit SDK.
- Run your first quantum circuit.
- Try a tutorial, such as Grover's algorithm.