Get the tutorials
The easiest way is to download the tutorials. Unzip the archive in the directory of your choice.
The more advanced user may choose to use git. If you have git installed, run
git clone https://github.com/QISKit/qiskit-tutorial.git
If you need to install git follow the instructions here.
The latest release version of QISKit should be the one installed.
The latest release can be installed using
pip install qiskit qiskit-acqua qiskit-acqua-chemistry
Or, pre-installed qiskit can be updated using
pip install -U qiskit qiskit-acqua qiskit-acqua-chemistry
BUT we recommend the following:
-
Install conda
-
Create conda environment for QISKit and install packages (with the accompanying
QISKitenv.ymlfile)
cd qiskit-tutorial
conda env create -f QISKitenv.yml
If you have already created QISKitenv, you can upgrade it by running
conda env update -f QISKitenv.yml
Create the Qconfig.py from the template provided at Qconfig.py.template. Follow the three steps below.
- Create an IBM Q Experience account if you haven't already done so
- Get an API token from the IBM Q Experience website under "My Account" > "Advanced" > "API Token"
- You will insert your API token in a file called Qconfig.py in
the
qiskit-tutorialdirectory. The contents of the file should look like:
APItoken = 'my token from the Quantum Experience'
config = {'url': 'https://quantumexperience.ng.bluemix.net/api'}
if 'APItoken' not in locals():
raise Exception('Please set up your access token. See Qconfig.py.')
Activate the environment
For MacOS and Linux, run:
source activate QISKitenv
For Windows, run:
activate QISKitenv
Note for conda users
You need to be sure that you have installed the right Jupyter Kernel, because in the last conda version it's not installed by default.
python -m ipykernel install --user --name QISKitenv --display-name "Python (QISKitenv)"
Start Jupyter with the index notebook
jupyter notebook index.ipynb
You can visualize your quantum circuits directly from QISKit. To get publication-quality images, QISKit plots circuits using LaTeX, which means you will need to install some pre-requisite software. These include the pdflatex compiler for rendering latex documents, and the Poppler library for converting PDF to image. In the future, we will provide ways of plotting circuits without relying on Latex.
On Linux:
- Install MiKTeX
- Install Poppler:
- Run:
apt-get install -y poppler-utils
- Run:
On MacOS:
- Install MiKTeX.
- Install Poppler:
- Run:
brew install poppler
- Run:
On Windows:
- Install MiKTeX.
- Install Poppler:
- Download the latest binary.
- Extract the downloaded
.7zfile into user directory:c:\Users\<user_name>\. Note: You will need to have the 7zip software for this. - Add to PATH:
- Right click on "This PC" -> Properties -> Advanced System Settings -> Environment Variables
- Add
C:\Users\<user_name>\poppler-0.51\binto the user's path.
