You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains Python samples exploring quantum computing on IonQ's platform using various quantum programming libraries. These examples are a great place to start if you're interested in quantum computation, but aren't familiar with any of the libraries out there.
3
+
Python samples demonstrating quantum computing on IonQ's platform using popular quantum libraries. A great starting point for exploring quantum computation.
4
4
5
-
If you're looking for advanced and in-depth examples for a given library that implement a specific algorithm, check out some of the other projects in the [ionq-samples](https://github.com/ionq-samples) organization on GitHub.
5
+
For advanced examples implementing specific algorithms, check out the [ionq-samples](https://github.com/ionq-samples) organization.
6
6
7
7
---
8
8
9
-
## Prerequisites
9
+
## Quick Start
10
10
11
-
There are a wide variety of ways to run these notebooks, but for starters you'll need:
11
+
### Prerequisites
12
12
13
-
1.[Python](https://www.python.org/downloads/) installed, using a version between 3.8 and 3.11.
14
-
2. A [virtual environment](https://docs.python.org/3/library/venv.html) to help ensure your dependencies don't conflict with anything else you have installed.
15
-
3. An [IonQ API key](https://cloud.ionq.com/settings/keys), which optionally you can store as an environment variable for ease of use. Our notebooks expect to find it stored as `IONQ_API_KEY`.
16
-
4. An installation of the library you're wanting to run. You can install all libraries using one of the following methods:
13
+
- Python 3.10-3.13
14
+
-[IonQ API key](https://cloud.ionq.com/settings/keys) (set as `IONQ_API_KEY` environment variable)
17
15
18
-
**Option 1: Using uv (Fastest - Recommended)**
16
+
### Installation
19
17
20
-
[uv](https://github.com/astral-sh/uv) is an extremely fast Python package installer and resolver:
18
+
**Using pip:**
19
+
```bash
20
+
pip install -e .
21
+
```
21
22
22
-
```shell
23
-
# Install uv (if not already installed)
24
-
curl -LsSf https://astral.sh/uv/install.sh | sh
23
+
**Using uv (faster):**
24
+
```bash
25
+
curl -LsSf https://astral.sh/uv/install.sh | sh
26
+
uv pip install -e .
27
+
```
25
28
26
-
# Install all dependencies
27
-
uv pip install -e .
28
-
```
29
+
**Using conda:**
30
+
```bash
31
+
conda env create -f environment.yml
32
+
```
29
33
30
-
**Option 2: Using Conda**
34
+
### Running Notebooks
31
35
32
-
```shell
33
-
conda env create -f environment.yml
34
-
```
36
+
**Jupyter:**
37
+
```bash
38
+
jupyter notebook
39
+
```
35
40
36
-
**Option 3: Using pip**
41
+
**VS Code:**
42
+
Open any `.ipynb` file and select a Python kernel.
37
43
38
-
```shell
39
-
pip install -e .
40
-
```
44
+
**Cloud:**
45
+
Click the  badge in each notebook.
41
46
42
47
---
43
48
44
-
## Usage
49
+
## Docker
45
50
46
-
The samples are in the form of Jupyter notebooks, and you can view and run them using a local [Jupyter](http://jupyter.org/) installation, [VS Code](https://code.visualstudio.com/) (using the built-in Jupyter plugin), or [Google Colab](https://colab.research.google.com).
51
+
Run in a containerized environment:
47
52
48
-
If you're unfamiliar with Jupyter but you're used to a traditional IDE or code editor, VS Code is probably the right choice for you.
docker run -p 8888:8888 -e IONQ_API_KEY="your_api_key" ionq-notebooks
59
+
```
51
60
52
-
1. From your terminal, navigate to this repository and run the following command from within this directory:
61
+
Open [http://localhost:8888](http://localhost:8888) in your browser.
53
62
54
-
```shell
55
-
jupyter notebook
56
-
```
63
+
---
64
+
65
+
## Development
57
66
58
-
1. Once the server is started, it should automatically open your browser. In case it doesn't, you can navigate directly to it by pointing your browser at [http://localhost:8888](http://localhost:8888)
59
-
1. Navigate to the location of a `.ipynb` file and open it. If you don't have a particular SDK in mind, we recommend starting with `qiskit`, as its the most commonly used library today.
67
+
### Running Tests
60
68
61
-
#### VS Code
69
+
```bash
70
+
# All tests
71
+
pytest tests/
62
72
63
-
1. Open the folder in VS Code and navigate to a `.ipynb` file and open it.
64
-
1. If it's your first time using it, it will suggest a number of plugins that you may need to install before the notebook will be fully functional.
65
-
1. At the top-right of the screen, click on `Select Kernel` and choose an appropriate Python runtime to run the notebook in.
1. Open the notebook by clicking on the  badge located in each notebook. Or open this repository in [](https://mybinder.org/v2/gh/ionq-samples/getting-started/HEAD)
83
+
GitHub Actions automatically tests all notebooks on every push.
For support, you can submit issues or PRs in this repository. Alternatively, you can contact us at[support@ionq.com](mailto:support@ionq.com?subject=SDK%20help).
103
+
Submit issues or PRs in this repository, or contact [support@ionq.com](mailto:support@ionq.com?subject=SDK%20help).
Copy file name to clipboardExpand all lines: api.ipynb
+39-4Lines changed: 39 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,21 @@
11
11
"IonQ offers a set of API resources that allow you to submit and manage jobs directly. This notebook offers a few simple examples, but visit [docs.ionq.com](https://docs.ionq.com) for a complete guide with additional resources and functionality."
12
12
]
13
13
},
14
+
{
15
+
"cell_type": "code",
16
+
"execution_count": null,
17
+
"metadata": {},
18
+
"outputs": [],
19
+
"source": [
20
+
"%%capture\n",
21
+
"\n",
22
+
"# First, we install the essential libraries to our current Python runtime.\n",
23
+
"# \"%%capture\" (above) captures and in this case, hides the output of this \n",
24
+
"# cell, so you can comment it out if you need help debugging this step.\n",
25
+
"\n",
26
+
"%pip install requests"
27
+
]
28
+
},
14
29
{
15
30
"cell_type": "code",
16
31
"execution_count": null,
@@ -29,7 +44,10 @@
29
44
"# If your API key is stored as \"IONQ_API_KEY\" in your local environment, this\n",
30
45
"# should find it. Otherwise you'll be prompted to enter your API key manually.\n",
Copy file name to clipboardExpand all lines: cudaq.ipynb
+38-13Lines changed: 38 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,36 @@
1
1
{
2
2
"cells": [
3
3
{
4
-
"cell_type": "code",
5
-
"execution_count": null,
4
+
"cell_type": "markdown",
6
5
"metadata": {},
7
-
"outputs": [],
8
6
"source": [
9
-
"%%capture\n",
7
+
"# CUDA-Q\n",
10
8
"\n",
11
-
"# First, we install the essential libraries to our current Python runtime.\n",
12
-
"# \"%%capture\" (above) captures and in this case, hides the output of this \n",
13
-
"# cell, so you can comment it out if you need help debugging this step.\n",
9
+
"[](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/cuda-quantum/main.ipynb)\n",
14
10
"\n",
15
-
"%pip install cudaq"
11
+
"[CUDA-Q](https://nvidia.github.io/cuda-quantum/latest/) is NVIDIA's platform for hybrid quantum-classical computing. It provides a unified programming model for quantum algorithm development and seamlessly integrates with classical computing workflows."
16
12
]
17
13
},
18
14
{
19
15
"cell_type": "markdown",
20
16
"metadata": {},
21
17
"source": [
22
-
"# CUDA-Q\n",
18
+
"⚠️ **Note:** CUDA is not compatible with Apple computers—given that it relies on Nvidia hardware being available. While the `cudaq` library _will_ install on a Mac, it will fail to run with a `ModuleNotFoundError`. "
19
+
]
20
+
},
21
+
{
22
+
"cell_type": "code",
23
+
"execution_count": null,
24
+
"metadata": {},
25
+
"outputs": [],
26
+
"source": [
27
+
"%%capture\n",
23
28
"\n",
24
-
"[](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/cuda-quantum/main.ipynb)\n",
29
+
"# First, we install the essential libraries to our current Python runtime.\n",
30
+
"# \"%%capture\" (above) captures and in this case, hides the output of this \n",
31
+
"# cell, so you can comment it out if you need help debugging this step.\n",
25
32
"\n",
26
-
"[CUDA-Q](https://nvidia.github.io/cuda-quantum/latest/) is NVIDIA's platform for hybrid quantum-classical computing. It provides a unified programming model for quantum algorithm development and seamlessly integrates with classical computing workflows."
0 commit comments