[PYTHON] Install Qiskit

This article is the 21st day article of Shizuoka University Information LT Tournament Advent Calendar 2019.

Introduction

I had a hard time installing Qiskit, so I will write the procedure including environment construction.

What is Qiskit

It is a Python library provided by IBM to use the quantum computer "IBM Q Experience" that can be used on the cloud locally.

environment

Account creation

Go to IBM Q Experience (https://quantumexperience.ng.bluemix.net/qx/experience?_ga=2.112651264.560271821.1575446446-1806712598.1572994574) and create an account

Installation of Anaconda

Go to the following page to download the Anaconda installer.

For the installation of Anaconda, I referred to this article.

Create a virtual environment in Anaconda

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

Install packages that are dependent on Qiskit

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.

Qiskit environment setup

Log in to the account created in 1. and go to the My Account page. my_account_circle.png

Select the Copy token in the image below. token.PNG

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

Install Qiskit
Install pytorch
Install Activiti 6
ArcoLinux install
install python
Install virtualenv
Install mojimoji
Install Scipy
Install Memo
Install Ansible
install keras
Install Mu
Install skt-war-result
Install Django
Install PyTorch
install pillow
ArchmanLinux Install
Fedora 33 beta install
CentOS8 --Install --Django
Install Python locally
Install easy_install (Windows)
Troubleshooting apt install
Install NAOqi python
Install from conda-forge
Install tensorflow. (Only!)
Install Apache Zookeeper
Install Python Control
Opencv install struggle
Install Apache Zeppelin
Install Apache ActiveMQ
BlueZ Build & Install
CentOS8 --Install --Python3
Install Numpy + atlas