Edit

Share via


Update the Azure Quantum Development Kit to the latest version

Learn how to update the Azure Quantum Development Kit (QDK) to the latest version.

Prerequisites

  • This article assumes that you already have the Azure QDK extension installed in Visual Studio Code (VS Code). If you're installing for the first time, then refer to the installation guide.

Update the VS Code extension

By default, VS Code automatically updates extensions. After an extension is updated, you're prompted to reload VS Code. To disable auto-updates and update your extensions manually, see Extension auto-update in the VS Code documentation.

Update the Azure Quantum Python packages

Important

If you're updating from a previous Qiskit environment, then see Update the qdk.azure module with Qiskit support in a virtual Python environment (recommended).

  1. Update to the latest qdk Python library with the azure extra:

    pip install --upgrade "qdk[azure]"
    
  2. To add support for the analysis, transformation, code generation, and simulation of Qiskit circuits, install the qiskit and jupyter extras.

    pip install --upgrade "qdk[qiskit,jupyter]"
    

Note

The QDK supports versions 1 and 2 of Qiskit.

The qdk.azure and qdk.qiskit Python modules includes optional support to create and submit Qiskit circuits to Azure Quantum. When you install the qdk.azure and qdk.qiskit modules, the latest version of Qiskit is installed by default, which might cause issues with an existing Qiskit environment. To ensure a stable development environment, create a virtual Python environment and install qdk.azure and qdk.qiskit in the virtual environment.

Note

If you're using Qiskit version 1, then see Qiskit 1.0 packaging changes for more information on package compatibility.

To create a virtual Python environment and install qdk.azure and qdk.qiskit, follow these steps:

  1. Create a local folder, for example ~/qiskit10-env.

  2. Run venv with the path to the folder.

    python -m venv ~/qiskit10-env
    
  3. Activate the environment.

    ~/qiskit10-env/bin/activate
    
  4. Run pip list to see that only the core packages are installed in the new environment.

  5. To install the qdk.azure and qdk.qiskit modules, run the following command:

    pip install "qdk[azure,qiskit]"
    
  6. Install other packages that you used in your previous environment as needed. Run the pip list command in each environment to compare packages and versions.

Note

You can also open your virtual environment in VS Code. From the View menu, choose Command Palette, and then enter Python: Create Environment and choose venv. Then, choose Open Folder... and select the environment folder that you created earlier. For more information on using environments in VS Code, see Python environments in VS Code.

Update the qdk.azure and qdk.qiskit modules in the current environment

You can also update the qdk.azure and qdk.qiskit modules without using a virtual environment. However, updates to the qiskit packages in an existing environment might cause dependency conflicts with other packages. See Qiskit 1.0 packaging changes for more information on package compatibility.

To update the qdk.azure and qdk.qiskit modules in your current environment, complete the following steps:

  1. Uninstall the existing qdk modules and other Qiskit dependencies:

    pip uninstall -y "qdk[azure,qiskit]" qiskit qiskit-terra qiskit-qir
    
  2. Reinstall the qdk library with the qiskit extra:

    pip install "qdk[qiskit]"
    

Update the Azure CLI quantum extension

Update or install the latest Azure CLI quantum extension.

  1. Open a Windows command prompt.

  2. From the command prompt, run the following command:

    az extension add --upgrade -n quantum