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.9 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 or Cirq support, install
azure-quantumwith theqiskitorcirqextras:Important
If you're updating from a previous Qiskit environment, see Update the azure-quantum package with Qiskit support.
python -m pip install azure-quantum[qiskit]or
python -m pip install azure-quantum[cirq]or
python -m pip install azure-quantum[qiskit,cirq]Install optional Python packages to display results and work in Jupyter Notebook:
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
The Azure CLI is an optional method for submitting quantum jobs using a terminal window in VS Code.
Install the Azure CLI.
Open a Windows command prompt.
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.