Get started with a Jupyter notebook and Qiskit in Azure Quantum

Learn how to run Python code that use the Qiskit library in a Jupyter notebook with Azure Quantum. A Jupyter notebook is a document that contains both rich text and code and can run in your browser, and can run Q# and Python code with Azure Quantum.

In this article, you will run a sample notebook that sends a basic quantum circuit expressed using the Qiskit library to an IonQ target via the Azure Quantum service. Qiskit is an open-source framework for working with noisy quantum computers at the level of pulses, circuits, and algorithms. For more information about Quiskit, see the Qiskit documentation.

For more information about Jupyter notebooks, see Run Jupyter notebooks in an Azure Quantum workspace.

Prerequisites

Before you begin, you need the following prerequisites to use Jupyter notebooks in an Azure Quantum workspace.

Get sample notebook

To get started, copy the sample notebook from the notebook gallery.

  1. Select your Azure Quantum workspace in the Azure portal.

  2. Select Jupyter Notebooks.

  3. Select Notebook Gallery.

  4. Select the Qiskit and IonQ notebook , and select Copy to My Notebooks.

    Notebook gallery in Azure Quantum.

The sample notebook can be found under My Notebooks and you can now run the notebook.

Run notebook

To run the Jupyter notebook, follow these steps.

  1. Select your Azure Quantum workspace in the Azure portal.

  2. Select Jupyter Notebooks.

  3. Select the qiskit-ionq notebook in My Notebooks.

  4. Select the cell you want to run and select the run icon to execute the code in the cell, or select Run all to run all cells in the notebook.

    Run a Jupyter notebook.

    The notebook first imports the required packages for the sample, then connects to the Azure Quantum service, and then runs a simple Qiskit circuit.

Note

If you have any questions regarding the workspace creation process or run into any issue at any point using Azure Quantum, bookmark Azure Quantum office hours and join our open office hours every Thursday 8∶30 AM Pacific Standard Time zone (PST).

Next steps