Different ways to run Q# programs
Azure Quantum offers different development options for writing and running quantum programs. Each environment uses the Quantum Development Kit (QDK), a set of open-source tools that includes the Q# programming language. For more information, see Introduction to Q#.
In this article, you learn the differences between each option and how to choose the right one for your needs.
Options for running Q# programs
Azure Quantum is available through three development environments:
- Azure Quantum website: Use Copilot to write, run, and explain Q# code in your browser. No installation or Azure account required.
- Azure portal: Manage your Azure subscription and Azure Quantum workspace, where you can write and run Q# and Python programs in Jupyter Notebooks. No installation required.
- Visual Studio Code: Write, run, and debug quantum code in your local environment, using Q# as a standalone program or with Python. Installation required.
The option you choose for running Q# programs depends on your coding experience, quantum knowledge, and goals. Because each option has different features and functionality, you typically use them together, such as writing Q# programs with the QDK extension in VS Code while managing your quantum workspace in the Azure portal. For more information, see the following table:
Azure Quantum website | Azure portal | Visual Studio Code | |
---|---|---|---|
Built-in Q# support | ✔ | ✔ | ✔ * |
QPU access | ✔ | ✔ | ✔ ** |
Jupyter Notebooks | ✔ | ✔ | |
Resource Estimator | ✔ | ||
Python support | ✔ | ✔ | |
Cirq and Qiskit support | ✔ | ✔ | |
Integrated hybrid | ✔ | ||
Local setup | ✔ | ||
Quantum workspace creation | ✔ |
* VS Code provides rich Q# support, such as CodeLens, IntelliSense, and debugging.
** QPU access in VS Code requires an Azure subscription.
Azure Quantum website
On the Azure Quantum website, you can run Q# programs in an online code editor—no installation or Azure account required. Write your own Q# code, explore the built-in Q# samples, or prompt Copilot to code for you.
The Azure Quantum website also features blogs, articles, and videos from quantum experts and enthusiasts. The Quantum Katas deepen your knowledge with self-paced tutorials on the fundamentals of quantum computing and Q#.
For more information, see Explore Copilot in Azure Quantum.
Is the Azure Quantum website right for me?
The Azure Quantum website lets you run Q# programs in your browser and access various learning resources. If you're a quantum enthusiast who wants to learn by doing, the Azure Quantum website is for you.
The following table shows what you can and can't do on the Azure Quantum website:
You can: | You can't: | You need: |
---|---|---|
|
|
|
Azure portal
The Azure portal is the main interface of the Microsoft Azure cloud computing platform. From the portal, you can create an Azure Quantum workspace to run quantum programs, send them to quantum hardware providers, and store their results in an Azure Quantum storage account. You can also manage your subscriptions, activity, credit usage, quotas, and access control.
Tip
When you create an Azure Quantum workspace you automatically get USD500 free Azure Quantum Credits for each quantum hardware provider. You can use the Azure Quantum Credits to submit your first quantum programs to real quantum hardware.
Quantum workspaces include Azure Quantum notebooks, which are web-based Jupyter Notebooks in the Azure portal. Use Azure notebooks to create, upload, store, and run Q# and Python programs on quantum simulators or hardware. From your quantum workspace, you can use sample notebooks to get started with quantum programming.
Is the Azure portal right for me?
From the Azure portal, you can grant a group of users, like your team members or students, access to your quantum workspace. If you want to manage your subscriptions, review your invoices, or add quantum providers, the Azure portal is for you.
The following table shows what you can and can't do in the Azure portal:
You can: | You can't: | You need: |
---|---|---|
|
|
|
Visual Studio Code
Visual Studio Code is a free, open-source code editor from Microsoft. With the Quantum Development Kit extension for Visual Studio Code, you can create Q# programs, load built-in Q# samples, and use features like error messaging, syntax highlighting, debugging, circuit diagram visualization, CodeLens, and IntelliSense—all in your local development environment. To get started, see Set up the Quantum Development Kit.
With Visual Studio Code and the QDK you also have access to the Azure Quantum Resource Estimator to estimate the physical resources required to run your Q# programs on quantum computers. For more information, see Run the Resource Estimator in Visual Studio Code.
You don't need an Azure account to use the QDK in Visual Studio Code. However, if you have an Azure account, you can connect to your Azure Quantum workspace from Visual Studio Code and run Q# programs on the quantum computers and simulators of your selected providers. For more information, see How to submit Q# programs with Visual Studio Code.
Note
The QDK extension is also available for VS Code for the Web, which provides the same Azure connectivity and Q# language features as the desktop version. However, it doesn't support Python, Qiskit, or Cirq.
Integration of Q# and Python
In VS Code, you can use Q# by itself or with Python, which requires the qsharp
and azure-quantum
Python packages. To install these packages, see Add support for Python and Jupyter Notebooks.
The following table shows how to use Q# with and without Python in VS Code:
Format | Files | Description |
---|---|---|
Q# | .qs | A Q# program that contains only Q# code. |
Q# and Python | .qs and .py | The Python program is a host program that, at some point in its routine, calls and uses the results of the Q# program. This is typically for complex projects. |
Jupyter Notebook | .ipynb | The Python kernel supports both code and text cells. By default, code cells use Python, but you can change them to Q# with the %%qsharp command. This means you can have Python code, Q# code, and explanatory text in one file. For more information, see The %%qsharp command. |
Is Visual Studio Code right for me?
VS Code is a feature-rich environment that includes CodeLens and IntelliSense for writing, running, and debugging quantum programs. If you have coding experience and want to explore Q# in depth, VS Code is for you.
The following table shows what you can and can't do in VS Code:
You can: | You can't: | You need: |
---|---|---|
|
|
|
Q# learning resources
To learn and explore the Q# programming language, use the following resources:
- Azure Quantum learning path: If you're interested in quantum computing but don't know where to start, take this learning path. Through a series of interactive modules, you learn about quantum computing and how to develop quantum solutions using Q# and the QDK.
- Quantum Katas: Learn quantum computing and programming simultaneously with these self-paced tutorials, each with relevant theory and Q# exercises to test your knowledge.
- Q# code samples: Build your first quantum solution with these ready-to-use Q# samples. They cover four areas: quantum algorithms, resource estimation, language constructs, and Jupyter Notebooks.
- QDK playground: Explore common quantum algorithms written in Q#. The playground is hosted on VS Code for the Web and comes preconfigured with the QDK, so you don't need to install anything.