字幕表 動画を再生する
- So let's get started.
では始めましょう。
- [Paul] That was good, but the screen
- [ポール] 良かったけど、途中で
turned off in the middle of it.
スクリーンが消えたから。。
- [Grunts comically]
- [コミカルなうなり声]
- [Paul] All right, let's do the intro.
- [ポール] よし、イントロをやろう。
[Upbeat Music]
[音楽]
- [Abe] Hello again.
- [エイブ] また会いましたね。
This is Abe and welcome back
エイブです。
to Coding with Qiskit.
Coding with Qiskit にようこそ。
In this episode, we're going to install Qiskit
このエピソードでは、Qiskit をインストールして
on our computer and get started writing code.
コーディングを開始できるようにします。
Now we're going to make sure
Mac、Windowsマシン、Linuxマシンの
that you're ready to go whether you're using a Mac,
いずれを使用している場合でも
a Windows machine, or a Linux machine.
準備ができていることを確認します。
So we're going to achieve two things.
そのために二つのことを達成します。
The first thing that we're going to do
最初にやろうとしていることは、
is first set up Qiskit on our computer
まず、一つ目としてコンピューターにQiskitをセットアップし
and then what we're going to do is
二つ目に、IBM Quantum Experienceから
get an access token from the IBM Quantum Experience.
アクセストークンを取得することです。
So that access token allows us to write code
アクセストークンは、自分のパソコンだけでなく
that we can then run, not just locally on our computers
IBMの本物の量子コンピューターの上でも
but also on real quantum computers at IBM.
コードを実行可能にします。
So in order to install Qiskit,
Qiskit をインストールするために
the first thing I'm going to do
最初にすることは
is make sure that I have all
全ての要件がそろっていることを
the requirements ready.
確認することです。
And to do this, I'm going to install
そのために、Anaconda Pythonとよばれる
a distribution of Python called Anaconda Python.
Pythonのディストリビューションを インストールします。
Now I'm going to be installing things
さて、私はMacの上にインストールしますので、
on a Mac so every time I see a step
いつものように少し注意して
that requires a little bit of attention,
やりかたを見ていきます。
if you're on Windows or on Linux machines,
WindowsまたはLinuxマシンの場合の注意点は、
I'll point those out.
その都度、指摘していきます。
So we start off by opening a new browser window
では、新しいブラウザーのウィンドウを開いて
and typing in: Anaconda Python.
Anaconda Pythonとタイプします。
This will take us to a distribution page
Anaconda Pythonのディストリビューションの
for Anaconda Python which allows me to now
ページにたどり着いたので、
install it on my computer.
ここからコンピューターにインストールできます。
As I said, I'm using a macOS right now
先ほど言ったように、私は今、 macOSを使っていますが、
but if you're on a Windows machine
WindowsマシンまたはLinuxマシンを
or a Linux machine, you'd have to change
使っている場合は、それによって
depending on which set-up you'd like to use.
インストールするセットアップを変えます。
Now one thing I'd like to point out here,
ここで
is that if you're on a Windows machine,
Windowsマシンを使っている場合は、
what you are downloading is an executable
ダウンロードしているのが実行ファイルであり、
which will then install Anaconda on your computer.
それがコンピューターにAnacondaをインストールするということです。
If you're on a Linux machine,
Linuxマシンを使っている場合には
you're downloading an .sh file.
あなたは、.sh fileをダウンロードします。
So let's do the macOS installation.
macOS でやってみましょう。
And a key thing to remember here is
ここでのポイントは、
we're going to be using Python 3.7.
Python 3.7を使うということです。
There is another distribution for 2.7
2.7のディストリビューションもありますが、
but we're not going to be using that.
こちらは使いません。
So let's go to the Python 3.7 version
では、Pythonのバージョン3.7のところで
and click Download.
Downloadをクリックします。
As you might imagine,
想像通り
the download will take a few moments
ダウンロードには数分かかりますので、
so this is a good point to pause the video
ビデオを一時停止しましょう。
and come back to it once your download is complete.
ダウンロードが終わったら戻ってきてください。
Once the download is complete,
ダウンロードが完了したら、
I'm going to go to my Downloads folder
ダウンロード フォルダーに行って
and click the Anaconda package.
Anacondaパッケージをクリックします。
I'm going to click Continue on this step
このステップではContinueをクリックして
and then follow the installation instructions.
インストール手順にしたいがいます。
So usually the default settings are good enough
一般的には、デフォルトセッティングで十分なので
so I'm just going to do this very quickly.
これを素早く実行できます。
And as this installation is proceeding,
インストールが進行している間に
I would like to remind you again,
もう一度リマインドしますが、
if you're on a Windows machine,
Windowsマシンを使っている場合は
you would go to your Downloads folder
ダウンロードフォルダーに行って
and run the executable for the Anaconda distribution
Anacondaディストリビューションの実行ファイルを実行します。
and if you're on a Linux machine,
Linuxマシンの場合には、
you're going to open your terminal,
ターミナルで
switch to that folder, your Downloads folder,
フォルダーをダウンロード フォルダーに切り替えて
and then type: bash, along with the name
bash の後にダウンロードしたファイルの名前を
of the file that you downloaded.
タイプします。
As of this video, it was an .sh file.
このビデオのように、それは .shファイルです。
So once the installation completes,
インストールが完了したら、
I'm going to close
クローズして
and start my terminal.
ターミナルを開けます。
And then install Qiskit by typing in: pip install qiskit.
そして、pip install qiskit とタイプして Qiskitをインストールします。
So this procedure is the same on all devices.
この手順はどのデバイスでも同じです。
On Windows machine, you would open the Anaconda Prompt.
Windowsマシンでは、Anaconda プロンプトをオープンします。
So go to your Start Menu and type: Anaconda Prompt.
そして、Start Menuから Anaconda Prompt とタイプします。
Open that terminal window and type: pip install qiskit
ターミナルウィンドウを開けて、 pip install qiskit とタイプします。
and on a Linux machine, you'd do exactly
Linuxマシンでは、
what we did here which is open your terminal
ターミナルで同じように
and type: pip install qiskit
pip install qiskit とタイプします。
so similar instruction on all three operation systems.
このように、三つのOSとも似た手順です。
All right, and once that's done,
では、これができたら、
we're ready to start using Qiskit.
Qiskit を使い始められます。
So what I'm going to do is
ここでやろうとしていることは、
use the Jupyter Notebook interface
Jupyter Notebookのインターフェースを使って
to write Qiskit code
Qiskit のコードを書くことなので、
so while we're in this terminal window,
このターミナルウィンドウで
what I'm going to do is type: jupyter notebook.
jupyter notebook とタイプします。
Notice how the spelling of Jupyter
Jupyter は Y が入っていることに
has a Y in it.
注意してください。
Once I do that, Jupyter opens in a new browser window
これができたら、Jupyter が新しいブラウザーのウィンドウを開いて
and you get something that looks like this.
このように見えます。
So the first thing to do,
ここで最初に
is create a new Jupyter notebook
Python 3の新しいJupyter notebook を
based on Python 3.
作ります。
And this is what the page looks like.
ページの見た目はこのような感じです。
So the first thing I'm going to do
最初に
is make sure that my Qiskit installation
Qiskit のインストールが完了しているか
is complete.
確認します。
So what I'm going to do
ですので、ここでQiskit をインポートする
is write some Python code to import Qiskit here.
Python コードを書きます。
And that's going to say: import qiskit
import qiskit と入れて、
and hit Shift plus Enter.
シフトを押しながらエンターを押します。
If you have Qiskit installed,
Qiskit がインストールされていれば、
this line should execute and you should see that line
この行が実行されて、
go from In to In 1.
In が In[1] になります。
And to make sure that the version of Qiskit
そして、Qiskit のバージョンが
is the latest version,
最新か確認するために、
I'm going to type: qiskit.__qiskit_version__
qiskit.__qiskit_version__ とタイプします。
When you do that, you should see an output
そうすると、このようなアウトプットになり
that tells you the version of Qiskit
あなたのインストールしたQiskit の
that you have installed.
バージョンがわかります。
As of this video, the version of Qiskit
このビデオでは、Qiskit のバージョンは
that's the latest is 0.11.1
今時点で最新の0.11.1です。
and the versions that you see under that
その下に見えるものは、
are the components of Qiskit.
Qiskit のコンポーネントのバージョンです。
The four elements that we'll be talking about
これからこのビデオシリーズでとりあげる
throughout this video series.
4つの要素です。
Remember that Qiskit is open source software
Qiskit はオープンソースのソフトウェアなので
so what you can do is go to Qiskit.org,
Qiskit.org に行って、
find the link to our GitHub page,
GitHub ページのリンクから
go to the Qiskit repository
Qiskit リポジトリーに行き、
and scroll down in the ReadMe
ReadMe をスクロールすると
and see what release version there is.
リリースされているバージョンを見ることができます。
So as you see, this is release 0.11.1
このように、リリース0.11.1が
which is exactly what we're seeing
Jupyter notebookで見たものと
in our Jupyter notebook.
まったく同じです。
So we're up to date and we're ready to start
ですので、私たちは最新バージョンで
writing code.
コードを書く準備ができました。
While we write our code,
コードを書くときには、
what we will usually do is first,
通常まず、
debug our code on a simulator
シミュレーターでコードのデバッグをし、
and once we're ready to run our code
コードの実行準備ができたら、
we'll send it to a quantum device.
量子デバイスに送信します。
In order to use the quantum devices at IBM,
IBMにある量子デバイスを使うために
we need to get an API token
デバイスの使用を可能にする
which gives us permission to use the devices.
APIトークンを取得する必要があります。
So to get that API token,
APIトークンを取得するために
we need to create an account
IBM Quantum Experienceのウェブサイトで
on the IBM Quantum Experience website.
アカウントを作る必要があります。
That website is quantum-computing.ibm.com.
ウェブサイトは、quantum-computing.ibm.com にあります。
Once you get to the website,
サイトにたどり着いたら、
you need to create a new account,
アカウントを持っていない場合は
if you don't have an account.
新しいアカウントを作る必要があります。
Once you log into the IBM Quantum Experience website,
IBM Quantum Experienceのサイトにログインすると
you should be seeing a page that looks similar
このようなページになります。
to this.
このサイトでは、
So this website allows you to first,
サーキット コンポーザーとよばれるツールで
create a quantum circuit graphically
量子回路をグラフィカルに作ることができ、
by using, what we call a circuit composer
オンラインのQiskit notebook も
or to use online Qiskit notebooks
左側のQiskit Notebooks をクリックするか、
by going to the left side and clicking
または、
Qiskit Notebooks
ホーム画面から
or by going to the homepage
Create a notebook をクリックして 使うことができます。
and clicking Create a notebook.
これは、
So you can think of this
あなたのローカルマシンで行ったように
as a way of running Jupyter notebooks
Qiskitをインストールした状態のJupyter notebooksを
online with Qiskit installed
オンラインで実行する方法と考えることができます。
just like we did on our local computer.
取得するAPIトークンは、
In order to get your API token,
IBMの量子デバイスにアクセスするコード
remember this is your access code
だということを覚えておいてください。
to IBM's quantum devices.
この右上のバーをクリックして
You would go to your profile page
My Account をクリックすると
by clicking this top right bar
Profileのページに入ります。
and clicking My Account.
これがあなたのAPIトークンです。
And this is your API token.
このように見えないように隠れていて、 Copy Tokenをクリックします。
So it's hidden from view, you'd click Copy Token.
Jupyter notebook では、
On the Jupyter notebook, we're going to type:
from qiskit import IBMQ とタイプして
from qiskit import IBMQ
シフト+エンターを押して実行し、
and hit Shift, Enter to execute that line
次に、IBMQ.save_account とタイプして
and then we're going to type: IBMQ.save_account
' ' の中に
and then within single quotes
さきほどのAPIトークンを
I'm going to type in my API token
ペーストします。
that I pasted from that website.
これができたら、
Once you do this,
あなたのAPIトークンが あなたのコンピューターに保存され、
your API token is saved onto your computer
IBMの量子デバイスにアクセスする準備が整いました。
and now you're ready to access IBM's quantum devices.
デバイスにアクセスできることを確認するために
To see that you have access to these devices,
IBMQ.load account とタイプします。
what you can do is then type: IBMQ.load account.
この行が実行されると
Once this line executes,
実行結果は、
you should see an output that tells you
あなたがアクセスし、コードを実行できる
the account that you have access to
アカウントを教えてくれます。
and you should be able to proceed
これは、あなたのコンピューター上で 量子回路をを設計し、
with running code, not just on your computer,
あなたのコンピューター上だけでなく、
but then sending the quantum circuits
IBMの量子デバイスにもそれを送って
that you build in your computer
結果を得ることができる
to IBM's quantum devices and getting results
アカウントです。
back from them.
さて、Qiskit のインストールが完了し
So now that you've installed Qiskit,
コードを書き、
you're ready to start writing code
量子回路を設計し、
and building your quantum circuits
それをシミュレーターと量子ハードウェアで
and executing them, both on simulators
実行する準備ができました。
and on quantum hardware.
これのエキサイティングなところは、
This is the exciting part,
あなたのコンピューター上でテストするだけではなく
where you get to build,
IBMの実験室でデプロイして結果を 得ることができる点です。
not just things to test on your computer,
それがゲームになっている
but to deploy in a lab at IBM and get results back
場合もあります。
and these could be games.
これは、産業用のアプリケーション、または
These could be applications for industry
あなたが個人的に興味をもっていることの アプリケーションにもなりえます。
or even things you personally are interested in.
次のエピソードで
We'll start off in the next episode
シンプルな量子回路をシミュレーターと
by showing you how to run a simple quantum circuit,
IBMのハードウェアで
both on a simulator on your computer
どのように実行するかお見せします。
and on the hardware at IBM.
Qiskit のインストールでトラブルがあったら、
If at any point, you had trouble installing Qiskit
Qiskit の Slack チャネルで
please feel free to reach out to us
遠慮なく
on our Qiskit Slack channel
サポートをもらってください。
where you can get support.
IBMからだけでなく、コミュニティーの
Not just from IBM but also from people
メンバーがサポートしてくれます。
in the community.
Slack チャネルのリンクを
We'll post a link to the Slack channel
この下の説明部分にポストしておきます。
down in the description.
[ヒップホップミュージック]
[Upbeat Hip Hop]