Edit

Different ways to run Q# programs

The Microsoft Quantum Development Kit (QDK) offers two development options to write and run Q# programs. Both options interface with Azure Quantum so that you can run Q# programs on simulators and quantum hardware from Azure Quantum providers. The QDK also includes several local simulators to run Q# programs on your personal computer.

Options to develop and run Q# programs

Develop Q# programs and manage Q# jobs that you submit to Azure Quantum through the following development environments:

  • Visual Studio Code: Write, run, and debug Q# code in your local environment, and submit jobs to Azure Quantum with the QDK extension in Visual Studio Code (VS Code). Installation required.
  • Jupyter Notebook: Develop Q# code and submit jobs to Azure Quantum in Jupyter Notebook with the qdk.qsharp Python module. Installation required.
  • Azure portal: Manage your Azure subscription and Azure Quantum workspace, and access information about your quantum providers and job submissions. Requires an Azure account.

The option that you choose depends on your coding experience, quantum knowledge, and goals. Each option has different features and functionality, so you can use them together. For example, write Q# programs with the QDK extension in VS Code and manage your quantum workspace in the Azure portal.

Visual Studio Code

VS Code is a free, open-source code editor from Microsoft. With the QDK extension for VS Code, you can create Q# programs and load built-in Q# samples. The QDK in VS Code offers the following local development features and more for Q# programs (.qs files):

  • Error messaging
  • Syntax highlighting
  • Debugging
  • CodeLens
  • IntelliSense
  • Quantum computer resource estimation

Note

The QDK extension also provides language support for OpenQASM programs (.qasm files).

You don't need an Azure account to use the QDK in VS Code, but you do need an Azure account to submit jobs to Azure Quantum with the QDK. You can use the QDK to connect to your Azure Quantum workspace from VS Code and run Q# programs on the quantum computers and simulators from different Azure Quantum providers. For more information, see How to submit Q# programs with Visual Studio Code.

To get started with the QDK extension in VS Code, see Set up the QDK.

Note

The QDK extension is also available in VS Code for the Web, which provides the same Azure connectivity and Q# language features as the desktop version. However, the web doesn't support Python, Qiskit, or Cirq programs.

Is the QDK extension in VS Code right for me?

VS Code is a feature-rich environment that includes CodeLens and IntelliSense to help you write, run, and debug Q# and OpenQASM quantum programs. If you have coding experience and want to explore Q# in depth, then 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:
  • Run Q# and OpenQASM programs.
  • Load code samples.
  • Debug your programs.
  • Save your programs and results.
  • View compiler error messages.
  • Connect to your Azure Quantum workspace.
  • Visualize quantum circuits.
  • Use the resource estimator.
  • Manage your subscriptions and workspaces.
  • Manage your quantum jobs.
  • Choose quantum computing providers and plans.
  • To install VS Code.
  • To install the QDK extension.
  • An Azure subscription and a quantum workspace (if you want to run programs on real hardware).

Jupyter Notebook

The QDK has a rich qdk Python library that allows you to develop Q# programs in .py Python files or Jupyter Notebook. The QDK Python library also supports other quantum languages, such as Qiskit, Cirq, and PennyLane.

The qdk Python library includes several modules to help you develop quantum programs and manage Azure Quantum jobs. For example, the qsharp module lets you write Q# code in Jupyter Notebook, and the azure module lets you connect to your quantum workspace and submit jobs to Azure Quantum.

For an overview of the qdk Python library and module features, see the QDK project description on the PyPi website.

Is Python and Jupyter Notebook right for me?

Jupyter Notebook is convenient to write Python code and visualize output all in one development environment. If you prefer to develop in Python and want support for multiple quantum programming languages, then the QDK Python library and Jupyter Notebook are for you.

The following table shows what you can and can't do in Python and Jupyter Notebook:

You can: You can't: You need:
  • Develop in multiple quantum programming languages.
  • Save your programs and results.
  • Connect to your Azure Quantum workspace.
  • Visualize quantum circuits.
  • Use the resource estimator.
  • Manage your subscriptions and workspaces.
  • Manage your quantum jobs.
  • Choose quantum computing providers and plans.

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 jobs to quantum hardware providers, and store job results in an Azure Quantum storage account. You can also manage your subscriptions, activity, credit usage, quotas, and access control.

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 jobs and subscriptions, review your invoices, or try out different quantum providers, then 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:
  • Create quantum workspaces.
  • Manage your subscriptions and workspaces.
  • Copy workspace access keys.
  • Manage your quantum jobs.
  • Save your programs and results.
  • Choose quantum computing providers and plans.
  • Develop quantum programs
  • Visualize quantum circuits and results.
  • Calculate resource estimates for your programs.
  • An Azure subscription.
  • An Azure Quantum workspace.

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 in Azure Quantum using Q# and the QDK.
  • Quantum Katas: Learn quantum computing and programming together 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.