This article is the 21st day article of Shizuoka University Information LT Tournament Advent Calendar 2019.
I had a hard time installing Qiskit, so I will write the procedure including environment construction.
It is a Python library provided by IBM to use the quantum computer "IBM Q Experience" that can be used on the cloud locally.
Go to IBM Q Experience (https://quantumexperience.ng.bluemix.net/qx/experience?_ga=2.112651264.560271821.1575446446-1806712598.1572994574) and create an account
Go to the following page to download the Anaconda installer.
For the installation of Anaconda, I referred to this article.
After installing Anaconda, start Anaconda Prompt, change to the directory you want to work in, and enter the following command to create a virtual environment.
Anaconda Prompt
$ conda create -n environment name python=3
I create a virtual environment because I don't have Qiskit in the Conda package and I need to install Qiskit using pip on Anaconda. Then, enter the following command to start the created virtual environment.
Anaconda Prompt
$activate virtual environment name
Try installing Qiskit once with pip.
Anaconda Prompt
$ pip install qiskit
I hope this doesn't output any error, but in my case I was angry that there was no library called CVXOPT, so I installed it as follows.
Anaconda Prompt
$ conda install cvxopt
By the way, using pip here resulted in an error. This means that you have to use the pip and conda commands together, which can ruin your Anaconda environment. This is also one of the reasons for creating a virtual environment. After installing the required libraries, run the Qiskit installation command above again. Then run the following command to install the optional dependencies needed to use the display features available in Qiskit.
Anaconda Prompt
pip install qiskit-terra[visualization]
If an error message is displayed for this as well, install the dependent libraries, etc., and then re-execute.
Log in to the account created in 1. and go to the My Account page.
Select the Copy token in the image below.
Then start Python's interactive mode and enter the following command.
Replace the part that says MY API TOKEN
with the token you copied earlier.
>>> from qiskit import IBMQ
>>> IBMQ.save_account('MY API TOKEN')
Alternatively, save the above content as a file, for example token.py
, and execute it.
This is the end of Qiskit installation and environment construction. Thank you for your hard work.
Recommended Posts