Skip to content

Commit 6b0e089

Browse files
abbycrossbeckykd
andauthored
first pass at quick start page (#4041)
Co-authored-by: Rebecca Dimock <[email protected]>
1 parent 384b3df commit 6b0e089

File tree

8 files changed

+328
-12
lines changed

8 files changed

+328
-12
lines changed

docs/guides/_toc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
"title": "Introduction to Qiskit",
1010
"url": "/docs/guides"
1111
},
12+
{
13+
"title": "Quickstart",
14+
"url": "/docs/guides/quick-start"
15+
},
1216
{
1317
"title": "Install",
1418
"children": [

docs/guides/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,6 @@ You can find a catalog of projects in the [Qiskit ecosystem page](https://qiskit
139139
## Next steps
140140

141141
<Admonition type="tip" title="Recommendations">
142+
- Build your first circuit with the [Quickstart](/docs/guides/quick-start) guide.
142143
- [Install the Qiskit SDK and Qiskit Runtime](/docs/guides/install-qiskit).
143144
</Admonition>

docs/guides/quick-start.ipynb

Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "2e2023d1",
6+
"metadata": {},
7+
"source": [
8+
"# Quickstart"
9+
]
10+
},
11+
{
12+
"cell_type": "markdown",
13+
"id": "a82fbaaa",
14+
"metadata": {
15+
"tags": [
16+
"version-info"
17+
]
18+
},
19+
"source": []
20+
},
21+
{
22+
"cell_type": "markdown",
23+
"id": "7bbbdb4b",
24+
"metadata": {
25+
"jp-MarkdownHeadingCollapsed": true
26+
},
27+
"source": [
28+
"Build your first quantum circuit in under two minutes, on your local environment - no sign-in or API key necessary.\n",
29+
"\n",
30+
"<Admonition type=\"note\" title=\"New to Python and virtual environments?\">\n",
31+
"\n",
32+
"* Download Python and use a virtual environment with Qiskit (recommended).\n",
33+
"\n",
34+
"<details>\n",
35+
"<summary>Click to expand for more information about **Python**.</summary>\n",
36+
"\n",
37+
"- To install Python, first check the \"Programming Language\" section on the [Qiskit PyPI project page](https://pypi.org/project/qiskit/) to determine which Python versions are supported by the most recent release. For download instructions, see the [Python Beginners Guide.](https://wiki.python.org/moin/BeginnersGuide/Download)\n",
38+
"\n",
39+
"<Admonition type = \"note\">\n",
40+
"These instructions use the standard Python distribution from [pypi.org](https://pypi.org/). However, you can use other Python distributions, such as [Anaconda](https://docs.anaconda.com/anaconda/) or [miniconda](https://docs.anaconda.com/miniconda/), along with other dependency management workflows like [Poetry](https://python-poetry.org/docs/).\n",
41+
"</Admonition>\n",
42+
"</details>\n",
43+
"\n",
44+
" <details>\n",
45+
" <summary>\n",
46+
" Click to expand for more information on **virtual environments**.\n",
47+
" </summary>\n",
48+
" - Use [Python virtual environments](https://docs.python.org/3.10/tutorial/venv.html) to separate Qiskit from other applications.\n",
49+
" A Python virtual environment is an isolated space to work with Python for a specific purpose — so you can install whatever packages you wish, and set up libraries, dependencies, and so on, without affecting the \"base\" Python environment on your machine.\n",
50+
"\n",
51+
" One important advantage of a virtual environment is that if your Python environment becomes corrupted, you can easily delete it and start over!\n",
52+
"\n",
53+
" Choose a preferred location in which to store information about your virtual environments. Typically they're stored in a directory named `.venv` within each project directory.\n",
54+
"\n",
55+
" To set up a virtual environment, navigate to your project directory and create a minimal environment with only Python installed in it.\n",
56+
"\n",
57+
" <OperatingSystemTabs>\n",
58+
" <TabItem value=\"mac\" label=\"macOS\">\n",
59+
" ```shell\n",
60+
" python3 -m venv .venv\n",
61+
" ```\n",
62+
" </TabItem>\n",
63+
"\n",
64+
" <TabItem value=\"linux\" label=\"Linux\">\n",
65+
" ```shell\n",
66+
" python3 -m venv .venv\n",
67+
" ```\n",
68+
" </TabItem>\n",
69+
"\n",
70+
" <TabItem value=\"win\" label=\"Windows\">\n",
71+
" ```text\n",
72+
" python -m venv .venv\n",
73+
" ```\n",
74+
" </TabItem>\n",
75+
" </OperatingSystemTabs>\n",
76+
"\n",
77+
" Next, activate your new environment.\n",
78+
"\n",
79+
" <OperatingSystemTabs>\n",
80+
" <TabItem value=\"mac\" label=\"macOS\">\n",
81+
" ```shell\n",
82+
" source .venv/bin/activate\n",
83+
" ```\n",
84+
" </TabItem>\n",
85+
"\n",
86+
" <TabItem value=\"linux\" label=\"Linux\">\n",
87+
" ```shell\n",
88+
" source .venv/bin/activate\n",
89+
" ```\n",
90+
" </TabItem>\n",
91+
"\n",
92+
" <TabItem value=\"win\" label=\"Windows\">\n",
93+
" If using PowerShell:\n",
94+
"\n",
95+
" ```text\n",
96+
" .venv\\Scripts\\Activate.ps1\n",
97+
" ```\n",
98+
" If using Git Bash:\n",
99+
"\n",
100+
" ```text\n",
101+
" source .venv/scripts/activate\n",
102+
" ```\n",
103+
" If using command prompt:\n",
104+
"\n",
105+
" ```text\n",
106+
" .venv\\Scripts\\activate\n",
107+
" ```\n",
108+
" </TabItem>\n",
109+
" </OperatingSystemTabs>\n",
110+
" </details>\n",
111+
"\n",
112+
"</Admonition>\n",
113+
"\n",
114+
"\n",
115+
"## 1. Install Qiskit\n",
116+
"\n",
117+
"Run the following command in your terminal to install the Qiskit and Matplotlib packages, as well as the Qiskit visualization module.\n",
118+
"\n",
119+
"```shell\n",
120+
"pip install qiskit matplotlib qiskit[visualization]\n",
121+
"\n",
122+
"# On a zsh terminal, use this line instead:\n",
123+
"# pip install qiskit matplotlib 'qiskit[visualization]'\n",
124+
"```"
125+
]
126+
},
127+
{
128+
"cell_type": "markdown",
129+
"id": "c8da788c",
130+
"metadata": {},
131+
"source": [
132+
"## 2. Build your circuit\n",
133+
"\n",
134+
"Open a Python environment, then run this code to build a Bell state (two entangled qubits)."
135+
]
136+
},
137+
{
138+
"cell_type": "code",
139+
"execution_count": null,
140+
"id": "86784142",
141+
"metadata": {},
142+
"outputs": [
143+
{
144+
"name": "stdout",
145+
"output_type": "stream",
146+
"text": [
147+
"{'00': 505, '11': 519}\n"
148+
]
149+
}
150+
],
151+
"source": [
152+
"from qiskit import QuantumCircuit\n",
153+
"from qiskit.primitives import StatevectorSampler\n",
154+
"\n",
155+
"qc = QuantumCircuit(2)\n",
156+
"qc.h(0)\n",
157+
"qc.cx(0, 1)\n",
158+
"qc.measure_all()\n",
159+
"\n",
160+
"sampler = StatevectorSampler()\n",
161+
"result = sampler.run([qc], shots=1024).result()\n",
162+
"print(result[0].data.meas.get_counts())"
163+
]
164+
},
165+
{
166+
"cell_type": "markdown",
167+
"id": "9a3180c2-56d7-4224-91fa-13d8cb87d93d",
168+
"metadata": {},
169+
"source": [
170+
"The expected output is a near-even split between '00' and '11'."
171+
]
172+
},
173+
{
174+
"cell_type": "markdown",
175+
"id": "a110ac90",
176+
"metadata": {},
177+
"source": [
178+
"## 3. Visualize your results\n",
179+
"\n",
180+
"To get a histogram of your results, add the following code to your program."
181+
]
182+
},
183+
{
184+
"cell_type": "code",
185+
"execution_count": null,
186+
"id": "dc4ff012",
187+
"metadata": {},
188+
"outputs": [
189+
{
190+
"data": {
191+
"text/plain": [
192+
"<Image src=\"/docs/images/guides/quick-start/extracted-outputs/dc4ff012-0.avif\" alt=\"Output of the previous code cell\" />"
193+
]
194+
},
195+
"execution_count": 10,
196+
"metadata": {},
197+
"output_type": "execute_result"
198+
}
199+
],
200+
"source": [
201+
"from qiskit.visualization import plot_histogram\n",
202+
"\n",
203+
"counts = result[0].data.meas.get_counts()\n",
204+
"plot_histogram(counts)\n",
205+
"\n",
206+
"# Include the next line if you are not using Python in a Jupyter notebook\n",
207+
"# plt.show()"
208+
]
209+
},
210+
{
211+
"cell_type": "markdown",
212+
"id": "738d4fc4-29c9-46ab-9879-3365e2149d04",
213+
"metadata": {},
214+
"source": [
215+
"This result is a signature of quantum entanglement.\n",
216+
"\n",
217+
"## 4. See what happens\n",
218+
"\n",
219+
"Try changing the code to see how it affects the results. For example:\n",
220+
"\n",
221+
"- Add a third qubit by changing to `QuantumCircuit(3)`, and add a second CX gate with `qc.cx(1,2)`. The measurements should then change to 000 and 111, which means all three of these qubits have been entangled.\n",
222+
"\n",
223+
"- See your results shift by adding `qc.x(1)` to the end of the circuit."
224+
]
225+
},
226+
{
227+
"cell_type": "markdown",
228+
"id": "b6062a16",
229+
"metadata": {},
230+
"source": [
231+
"## Next steps\n",
232+
"\n",
233+
"<Admonition type=\"tip\" title=\"Recommendations\">\n",
234+
"- Run a circuit on real quantum hardware in the [Hello world](/docs/tutorials/hello-world) tutorial.\n",
235+
"- Not ready to run on hardware? Start your quantum journey with the [Basics of quantum information](/learning/courses/basics-of-quantum-information) course.\n",
236+
"</Admonition>"
237+
]
238+
}
239+
],
240+
"metadata": {
241+
"description": "Build and visualize a quantum circuit in under two minutes, no sign-in or API key necessary.",
242+
"kernelspec": {
243+
"display_name": "Python 3",
244+
"language": "python",
245+
"name": "python3"
246+
},
247+
"language_info": {
248+
"codemirror_mode": {
249+
"name": "ipython",
250+
"version": 3
251+
},
252+
"file_extension": ".py",
253+
"mimetype": "text/x-python",
254+
"name": "python",
255+
"nbconvert_exporter": "python",
256+
"pygments_lexer": "ipython3",
257+
"version": "3"
258+
},
259+
"title": "Quickstart"
260+
},
261+
"nbformat": 4,
262+
"nbformat_minor": 5
263+
}

docs/guides/save-credentials.mdx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ If you are working in a trusted Python environment (such as on a personal laptop
1717
1. Ensure that you have an [IBM Cloud account.](https://quantum.cloud.ibm.com/registration)
1818
1. Ensure you are working in an active Python environment with the [Qiskit SDK and Qiskit Runtime installed](/docs/guides/install-qiskit#local).
1919
1. Activate the Python virtual environment and run Python in your virtual environment.
20-
1. Find your access credentials.
21-
1. Log in to [IBM Quantum Platform](https://quantum.cloud.ibm.com) with an IBMid or Google account.
22-
1. Make sure that the correct account and region are selected in the account switcher in the header.
23-
1. Find your API key. From the [dashboard](https://quantum.cloud.ibm.com/), create your API key, then copy it to a secure location so you can use it for authentication. Note that you can use the same API key to connect to any region.
24-
1. Optional: Find the instance you want to use from the [Instances](https://quantum.cloud.ibm.com/instances) page. Hover over its CRN, click the icon to copy it, then save it in a secure location so you can use it to identify the instance.
20+
1. Log in to [IBM Quantum Platform](https://quantum.cloud.ibm.com) with an IBMid or Google account.
21+
22+
<span id="find-credentials"></span>
23+
## Find your access credentials
24+
25+
1. Make sure that the correct account and region are selected in the account switcher in the header.
26+
1. Find your API key. From the [dashboard](https://quantum.cloud.ibm.com/), create your API key, then copy it to a secure location so you can use it for authentication. Note that you can use the same API key to connect to any region.
27+
1. Optional: Find the instance you want to use from the [Instances](https://quantum.cloud.ibm.com/instances) page. Hover over its CRN, click the icon to copy it, then save it in a secure location so you can use it to identify the instance.
2528

2629
<span id="cloud-save"></span>
2730
## Save your access credentials

docs/tutorials/hello-world.ipynb

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,51 @@
4343
"id": "7b65f7e0",
4444
"metadata": {},
4545
"source": [
46-
"## Before you begin\n",
46+
"## Install and authenticate\n",
4747
"\n",
48-
"Follow the [Install and set up](/docs/guides/install-qiskit) instructions if you haven't already, including the steps to [Set up to use IBM Cloud&reg;.](/docs/guides/cloud-setup)\n",
48+
"1. If you have not already installed Qiskit, find instructions in the [Quickstart](/docs/guides/quick-start) guide.\n",
4949
"\n",
50-
"The code examples found in the IBM Quantum&reg; Platform documentation were developed by using [Jupyter](https://jupyter.org/install) notebooks. To follow along with the examples, it is recommended that you set up an environment to run Jupyter notebooks [locally](/docs/guides/install-qiskit#local-jupyter) or [online.](/docs/guides/online-lab-environments) Be sure to install the recommended extra visualization support (`'qiskit[visualization]'`). You'll also need the `matplotlib` package for the second part of this example.\n",
50+
" - Install Qiskit Runtime to run jobs on quantum hardware:\n",
5151
"\n",
52-
"To learn about quantum computing in general, visit the [Basics of quantum information course](/learning/courses/basics-of-quantum-information) in IBM Quantum Learning.\n",
52+
" ```bash\n",
53+
" pip install qiskit-ibm-runtime\n",
54+
" ```\n",
5355
"\n",
54-
"IBM&reg; is committed to the responsible development of quantum computing. Learn more about responsible quantum at IBM and review our responsible quantum principles in the [Responsible quantum computing and inclusive tech](/docs/responsible-quantum-computing) topic."
56+
" - Set up an environment to run Jupyter notebooks locally:\n",
57+
"\n",
58+
" ```bash\n",
59+
" pip install jupyter\n",
60+
" ```\n",
61+
"\n",
62+
"2. Set up your authentication for access to quantum hardware through the free [Open Plan](/docs/guides/plans-overview#open-plan).\n",
63+
"\n",
64+
" (If you were emailed an invitation to join an account, follow the [steps for invited users](/docs/guides/cloud-setup-invited) instead.)\n",
65+
"\n",
66+
" - Go to [IBM Quantum Platform](https://quantum.cloud.ibm.com/) to log in or create an account.\n",
67+
" - Generate your API key (also called an *API token*) on the [dashboard](https://quantum.cloud.ibm.com/), then copy it to a secure location.\n",
68+
" - Go to the [Instances](https://quantum.cloud.ibm.com/instances) page and find the instance you want to use. Hover over its CRN and click to copy it.\n",
69+
"\n",
70+
" - Save your credentials locally with this code:\n",
71+
"\n",
72+
" ```python\n",
73+
" from qiskit_ibm_runtime import QiskitRuntimeService\n",
74+
"\n",
75+
" QiskitRuntimeService.save_account(\n",
76+
" token=\"<your-api-key>\", # Use the 44-character API_KEY you created and saved from the IBM Quantum Platform Home dashboard\n",
77+
" instance=\"<CRN>\", # Optional\n",
78+
" )\n",
79+
" ```\n",
80+
"\n",
81+
"3. Now you can use this Python code any time you want to authenticate to the Qiskit Runtime Service:\n",
82+
" ```python\n",
83+
" from qiskit_ibm_runtime import QiskitRuntimeService\n",
84+
"\n",
85+
" # Run every time you need the service\n",
86+
" service = QiskitRuntimeService()\n",
87+
" ```\n",
88+
"<Admonition type=\"info\" title=\"Not using a trusted Python environment?\">\n",
89+
"If you are using a public computer or other unsecured environment, follow the [manual authentication instructions](/docs/guides/cloud-setup-untrusted) instead to keep your authentication credentials safe.\n",
90+
"</Admonition>"
5591
]
5692
},
5793
{
@@ -659,8 +695,13 @@
659695
"## Next steps\n",
660696
"\n",
661697
"<Admonition type=\"tip\" title=\"Recommendations\">\n",
662-
" - Learn how to [build circuits](/docs/guides/map-problem-to-circuits) in more detail.\n",
663-
" - Try the [Ground-state energy estimation of the Heisenberg chain with VQE](/docs/tutorials/spin-chain-vqe) tutorial.\n",
698+
" - Try one of these tutorials:\n",
699+
" - [Ground-state energy estimation of the Heisenberg chain with VQE](/docs/tutorials/spin-chain-vqe)\n",
700+
" - Solve optimization problems using [QAOA](/docs/tutorials/quantum-approximate-optimization-algorithm)\n",
701+
" - Train [quantum kernel](/docs/tutorials/quantum-kernel-training) models for machine learning tasks\n",
702+
" - Find detailed installation instructions in the [Install Qiskit](/docs/guides/install-qiskit) guide.\n",
703+
" - If you prefer not to install Qiskit locally, read about options to use Qiskit in an [online development environment.](/docs/guides/online-lab-environments)\n",
704+
" - To save multiple account credentials or to specify other account options, see detailed instructions in the [Save your login credentials](/docs/guides/save-credentials#save-your-access-credentials) guide.\n",
664705
"</Admonition>"
665706
]
666707
}
Binary file not shown.

qiskit_bot.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,9 @@ notifications:
496496
- "@pandasa123"
497497
- "@johannesgreiner"
498498
- "@Henri-ColibrITD"
499+
"docs/guides/quick-start":
500+
- "@abbycross"
501+
- "@beckykd"
499502
"docs/guides/qiskit-addons-sqd":
500503
- "@kaelynj"
501504
"docs/guides/qiskit-addons-sqd-get-started":

scripts/config/notebook-testing.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ test-strategies.ci = {}
1010
test-strategies.extended = {}
1111
test-strategies.hardware = { patch="qiskit-ibm-runtime-open" }
1212
notebooks = [
13+
"docs/guides/quick-start.ipynb",
1314
"docs/guides/build-noise-models.ipynb",
1415
"docs/guides/circuit-library.ipynb",
1516
"docs/guides/classical-feedforward-and-control-flow.ipynb",

0 commit comments

Comments
 (0)