Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article, you learn how to install the Azure Quantum Development Kit (QDK) extension for Visual Studio Code (VS Code) and add support for Python, Jupyter Notebook, and the Azure CLI.
Prerequisites
- The latest version of VS Code.
- If you want to submit jobs to Azure Quantum, then you need to have an Azure account with a quantum workspace. For more information, see Create an Azure Quantum workspace.
Install the QDK extension
To use the QDK in VS Code, install the QDK extension. You can also use the QDK in VS Code for the Web without installing the extension, but you won't have all the features of VS Code Desktop. For more information, see Different ways to run Q# programs.
You can now write, debug, and run Q# programs against the built-in quantum simulator. Or, if you have an Azure account, you can connect and submit Q# programs to quantum hardware, all from VS Code.
To test your setup, see Submit Q# jobs to Azure Quantum.
Add support for Python and Jupyter Notebook
With Python support in VS Code, you can embed or call Q# code from your Python programs or Jupyter notebooks, and run them on the built-in quantum simulator. You can also connect to your Azure Quantum workspace and submit your jobs to run on real quantum hardware.
Prerequisites
- Install a Python environment (3.10 or greater, 3.11 recommended) with Python and Pip.
- Install the QDK extension in VS Code.
Install the required packages
To add Python and Jupyter Notebook support:
Open the command line.
Install the
qdkPython library with theazureextra:python -m pip install "qdk[azure]"For Qiskit version 1 and version 2 support, install the
qiskitextra:python -m pip install "qdk[qiskit]"Important
If you're updating from a previous Qiskit environment, then see Update the
qdk.azuremodule with Qiskit support.To work in Jupyter Notebook and display visualizations, install the following Python packages:
python -m pip install "qdk[jupyter]" ipykernel ipympl jupyterlab
To test your setup, see Submit Q# jobs with Python or Submit Q# jobs with Jupyter Notebooks.
Add support for the Azure CLI
You have the option to use the Azure CLI to submit quantum jobs from a terminal window in VS Code.
Install the Azure CLI.
Open a Windows command prompt or a terminal in VS Code.
In the command prompt, run the following command to update to the latest Azure CLI
quantumextension:az extension add --upgrade -n quantum
To test your setup, see Submit Q# jobs to Azure Quantum.