Skip to content

Latest commit

 

History

History
115 lines (58 loc) · 3.16 KB

Install the Qiskit SDK from source _ IBM Quantum Documentation-20241021T113359799.md

File metadata and controls

115 lines (58 loc) · 3.16 KB

Install the Qiskit SDK and Qiskit Runtime from source

Installing the Qiskit SDK from source allows you to access the current development version, instead of using the version in the Python Package Index (PyPI) repository. This lets you inspect and extend the latest version of the Qiskit code more efficiently.

Create and activate a new virtual environment

  1. Create a minimal environment with only Python installed in it.

macOS

Linux

Windows

python3 -mvenv/path/to/virtual/environment

  1. Activate your new environment.

macOS

Linux

Windows

source/path/to/virtual/environment/bin/activate

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:

  1. Clone the Qiskit repository.

gitclonehttps://github.com/Q iskit/qiskit.git

  1. Change to the qiskit directory.

cdqiskit

  1. (Optional) If you want to run tests or linting checks, install the developer requirements.

pipinstall-rrequirements-dev.txt

  1. Install qiskit .

Standard install :

pipinstall.

Editable mode : In this mode, you don't need to reinstall Qiskit when there are code changes to the project.

pipinstall-e.

In editable mode, the compiled extensions are built in debug modewithout 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 releasemode:

pythonsetup.pybuild_rust--release--inplace

Note

If 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).

Install Qiskit Runtime

Follow these steps if you want to install Qiskit Runtime:

  1. Clone the Qiskit Runtime repository.

gitclonehttps://github.com/Q iskit/qiskit-ibm-runtime.g it

  1. Change to the qiskit_ibm_runtime directory.

cdqiskit_ibm_runtime

  1. (Optional) If you want to run tests or linting checks, install the developer requirements. We recommend using a virtual environment to avoid polluting your global Python installation.

pipinstall-rrequirements-dev.txt

  1. Install qiskit-runtime . We recommend using a virtual environment to avoid polluting your global Python installation.

Standard install :

pipinstall.

Editable mode : In this mode, you don't need to reinstall Qiskit when there are code changes to the project.

pipinstall-e.

In editable mode, the compiled extensions are built in debug modewithout optimizations.

Next steps

Recommendations

Read the contributing guidelines to contribute to the opensource Qiskit SDK.

Learn how to build circuits.

Run the Hello world program.

Try a tutorial, such as Grover's algorithm .

Was this page helpful?

Report a bug or request content on GitHub .