- Hi, my name is Nick Bronn.
I'm a researcher at IBM Quantum.
I use Quiskit for quantum computing education and research.
Today, we're gonna to talk about getting started with Qiskit
either locally on your computer
or over the cloud.
We'll also talk about how we get access
to IBM Quantum backends that are open
and freely available also over the cloud.
In a separate video,
we'll talk about installing and contributing
to the development branch of Qiskit.
This is useful for researchers and developers
in the field who need access
to the latest and greatest versions.
Maybe not the stable ones that
we're gonna talk about today.
Let's start by navigating the qiskit.org.
Everyone's favorite open source quantum development toolkit.
You can scroll down to the get started button,
click on it,
and then the quickest way
to get started with Quiskit is over the cloud.
So let's navigate to the start on the cloud tab
and then click on the IBM Quantum lab button.
If you haven't already,
you'll need to create an IBM ID account.
Once you're done with that
click on the IBM ID button to sign in.
Two factor authentication,
two factor authentication kids, or is it good idea.
(piano music)
After logging in,
you'll be taken to the IBM Quantum dashboard.
Since this is an important page we'll be coming back to,
we'll launch the lab in a new tab.
(upbeat music)
On the left You'll see your lab files,
which includes the Qiskit textbook
and tutorials for learning features of Qiskit.
In particular,
we'll get started with this getting started notebook
that you can download
and then upload to the quantum dashboard.
Once you've downloaded the getting started notebook,
click on the upload button and upload it from there.
Once you've done that, the notebook will appear here,
double click to open it.
This will open up the jupyter notebook
and we can see we're starting with loading
libraries from Qiskit that we need.
In particular, we need to load the IBM Q provider.
A provider is a host that provides access
to different kinds of quantum backends.
In order to see what kinds of backends
we have access to, we need to navigate back
to the dashboard and click on view account details.
Scrolling to the bottom,
you can see your providers.
I have a lot of them
because I've been around for awhile,
but everyone has access to the IBM Q open main provider.
Clicking on the three dots next to it,
you can copy the Qiskit provider code,
which we'll need for our notebook
and we'll navigate back there now.
Now paste that provider information into this first
cell and execute it by pressing Shift + Enter.
This will take a few seconds to load.
Here, we've output a list of backends
provided by the IBM Q provider.
This includes simulators as well as access
to actual quantum processors.
For this example,
any of these backends will do the trick,
but our mock only operates on one cubit.
So we're not going to use that.
In fact, I'll choose IBM Q Santiago.
So we'll just copy that and paste it into the,
get back method given by the provider.
Then we can execute that cell
and take a look at the backend itself.
We can see the connectivity of Santiago,
but we'll talk about that another time.
Let's move on to building our first quantum circuit.
This code will generate a bell state.
pressing shift in other cell show what
the circuit diagram of that state looks like.
I like the bell state because it shows
both the quantum effects of superposition
and entanglement.
Next we'll take a job that creates a bell state
and performs a measurement and send
it to the actual quantum hardware.
Each job has a unique ID that we can print out
to get the results later if we desire.
Now the job is queued and we're waiting to run it
on the actual hardware.
(upbeat music)
And after a short rate, our job has successfully run.
So let's put the results.
Here we see likely probabilities for measuring
either the zero, zero or one, one state
which is a good indicator we prepared a bell state,
and that's how you get started with Qiskit on the cloud.
(laughs)
And that's how you get started with Qiskit on the cloud.
Now we'll show you how to get started locally with Qiskit,
we're gonna use the Anaconda distribution of Python.
So navigate to anaconda.com, select products,
individual edition,
and download the open source free distribution
for your particular operating system.
Once you follow the install instructions,
open up a terminal or an Anaconda prompt
depending on your operating system.
Here's mine right here.
And we can see that I'm in the base Conda environment.
In order to keep things clean,
we're gonna manage our Conda environments,
and we can look at what we have
by doing conda env list.
(upbeat music)
Today we're gonna create a stable conda environment
that we can use for our stable install of Qiskit.
So I'll do conda, create - and for name Qiskit - stable,
and then I like to use the latest version
of Python myself.
(upbeat music)
Proceed at ( y ) at the prompt.
And we're going to be installing things for a little while.
(upbeat music)
Now that that's done,
let's activate our new environment,
Conda activate Qiskit stable.
Okay, now, now it's very easy to install Qiskit,
we just type in PiP install Qiskit.
And because I like all the visualization tools
that come with using Jupyter notebooks,
I'm going to add those libraries in here as well
by typing visualization and brackets.
And if you're on a recent Mac OS version like me,
you need to put those in quotation marks.
(upbeat music)
This will take a few minutes to run,
some great time to grab a cup of coffee.
I Think I'm going to grab a cup of coffee.
(upbeat music)
- So now that that's finished,
let's install a separate iPod on Kernel
so we can keep track of which version of Qiskit
we're running inside of our Jupyter notebooks.
We can do that by typing in python - M ipykernel
install -- user for everyone-- name
we'll call it the same thing Qiskit- stable,
and then give it the display name
Qiskit stable as well.
(upbeat music)
Okay, that was quick,
and one more thing we're gonna do is install rise
so that we can view Jupyter notebooks
and presentation mode.
And we can do that easily by typing in pip install rise.
All right, now that we're done installing packages,
let's launch our getting started notebook.
We can do that with Jupyter notebook-
getting started.
Now that Jupyter is spelled with a Y because it's Python.
This will open the notebook in a new tab
in your default browser.
Once we open the notebook,
we can check our Colonel was correct
by seeing the Qiskit stable here in the upper, right.
That's the one we just installed,
that's got the Qiskits stable version in it.
Then we can go into presentation mode
by clicking this graph right here.
The first thing we can do is make sure
we installed the latest stable version of Qiskit.
Again, this might take a moment to load the libraries.
Checking the version table,
we can confirm that we are indeed running
the latest stable version of Qiskit.
Pressing space to move on,
i can then go and import libraries that I need,
very similar to what we did on the cloud.
One thing that's different from the IBM quantum lab
is that we need to store our account information locally.
In order to do this,
navigate back to the IBM quantum dashboard
and copy your API token.
Now navigating back to the notebook,
we need to put that account number in quotes.
As you can see my credentials already present,
this is something you only need to do your first time
and it's best not to keep your account number around,
So I'll delete that.
Since the API token saved locally,
we don't need it anymore.
We can just load our accounts.
We'll use the same provider and same backend
that we did on the cloud.
Now let's create the same bell state
that we did in the cloud example.
We can see the circuit here,
how to mark fall by a C note.
Since we're running locally,
we might want to install a widget
such as the job watcher so we can see
how the jobs are going.
Taking the same job that consists of creating
a bell state, followed by a measurement,
we'll send it to the same actual quantum hardware.
Looking up at the widget, we can see our job ID,
the backend we submitted it to,
and where we are in the queue.
(upbeat music)
In the meantime, we can use the job ID
to pull the results from a previously run job.
We can get the results from the same job
and plot the histogram and see we get
the same telltale sign of entanglement.
So that's how you get started locally.
And this time we showed you how to plot
the results of a previously run job.
So that's how you get started with Qiskit
either locally or on the cloud.
In a future video,
we'll cover installing the development branch of Qiskit.
Do you have an idea of something we should cover?
Let us know in the comments below.
I've been your host, Nick Bronn.
Thanks a lot for watching.
(upbeat music)