General Requirements

Package Version Details
Python 2.7+ Version 3.4+ is highly recommended
Numpy 1.7+
SciPy 0.14+ Lower versions are missing features.
Matplotlib 1.2.0+ Lower versions are missing features.
Cython 0.21+ Needed for compiling some time-dependent Hamiltonians.
GCC 4.4+ Needed for compiling Cython files.
GFORTRAN 4.4+ Optional, needed for compiling the Fortran-based Monte Carlo solver.
BLAS 1.2+ Optional, Linux only. Needed for installing Fortran Monte Carlo solver.
Mayavi 4.1+ Optional. Needed for using the Bloch3d class.
Python Headers 2.7+ Linux only. Needed for compiling Cython files.
LaTeX TexLive 2009+ Optional. Needed if using LaTeX in Matplotlib figures.
Nose 1.1.2+ Optional. For running tests.

Platform-Independent Installation

Often the easiest way is to install QuTiP is to use the Python package manager pip.

pip install qutip

Or, optionally, to also include the Fortran-based Monte Carlo solver:

pip install qutip --install-option=--with-f90mc

More detailed platform-dependent installation alternatives are given below.

Installing From Source

Installing QuTiP from source requires that all the dependencies are satisfied. The installation of these dependencies is different on each platform, and detailed instructions for Linux (Ubuntu), Mac OS X, and Windows are given below.

Regardless of platform, to install QuTiP from the source code run:

sudo python setup.py install

To also include the optional Fortran Monte Carlo solver, run:

sudo python setup.py install --with-f90mc

On Windows, omit sudo from the commands given above.

Installation on Ubuntu Linux (recommended)

Using QuTiP’s PPA

The easiest way to install QuTiP in Ubuntu (14.04 and later) is to use the QuTiP PPA

sudo add-apt-repository ppa:jrjohansson/qutip-releases
sudo apt-get update
sudo apt-get install python-qutip

A Python 3 version is also available, and can be installed using:

sudo apt-get install python3-qutip

With this method the most important dependencies are installed automatically, and when a new version of QuTiP is released it can be upgraded through the standard package management system. In addition to the required dependencies, it is also strongly recommended that you install the texlive-latex-extra package:

sudo apt-get install texlive-latex-extra

Manual Installation of Dependencies

First install the required dependencies using:

sudo apt-get install python-dev cython python-setuptools python-nose
sudo apt-get install python-numpy python-scipy python-matplotlib

Then install QuTiP from source following the instructions given above.

Alternatively (or additionally), to install a Python 3 environment, use:

sudo apt-get install python3-dev cython3 python3-setuptools python3-nose
sudo apt-get install python3-numpy python3-scipy python3-matplotlib

and then do the installation from source using python3 instead of python.

Optional, but recommended, dependencies can be installed using:

sudo apt-get install texlive-latex-extra          
sudo apt-get install libblas-dev         
sudo apt-get install liblapack-dev      
sudo apt-get install gfortran

Installation on Mac OSX (10.8+)

Setup Using Homebrew

The latest version of QuTiP can be quickly installed on OS X using Homebrew and the automated installation shell scripts

Python 2.7 script | Python 3.4 script

Having downloaded the script corresponding to the version of Python you want to use, the installation script can be run from the terminal using (replacing X with 2 or 3)

sh install_qutip_pyX.sh

The script will then install Homebrew and the required QuTiP dependencies before installing QuTiP itself and running the built in test suite. Any errors in the homebrew configuration will be displayed at the end. Using Python 2.7 or 3.4, the python commend-line and IPython interpreter can be run by calling python and ipython or python3 and ipython3, respectively.

If you have installed other packages in the /usr/local/ directory, or have changed the permissions of any of its sub-directories, then this script may fail to install all the necessary tools automatically.

Setup Using Macports

If you have not done so already, install the Apple Xcode developer tools from the Apple App Store. After installation, open Xcode and install the ‘Command Line Tools’.

On the Mac OS, you can install the required libraries via MacPorts. After installation, the necessary “ports” for QuTiP may be installed via (Replace ‘34’ with ‘27’ if you want Python 2.7)

sudo port install py34-scipy
sudo port install py34-matplotlib +latex
sudo port install py34-cython
sudo port install py34-ipython +notebook+parallel
sudo port install py34-pip

Now, we want to tell OS X which Python and iPython we are going to use

sudo port select python python34
sudo port select ipython ipython34
sudo port select pip pip34

To install QuTiP, run

sudo pip install qutip --install-option=--with-f90mc

Anaconda CE Distribution

Finally, one can also use the Anaconda package to install all of the QuTiP dependencies and then install QuTiP from the source package.

Installation on Windows

QuTiP is primarily developed for Unix-based platforms such as Linux an Mac OSX, but it can also be used on Windows. We have limited experience and ability to help troubleshoot problems on Windows, but the following installation steps have been reported to work:

  1. Install the Python(X,Y) distribution (tested with version 2.7.3.1). Other Python distributions, such as Enthought Python Distribution or Anaconda CE have also been reported to work.

  2. When installing Python(x,y), explicitly select to include the Cython package in the installation. This package is not selected by default.

  3. Add the following content to the file C:/Python27/Lib/distutils/distutils.cfg (or create the file if it does not already exists):

[build]
compiler = mingw32

[build_ext]
compiler = mingw32

The directory where the distutils.cfg file should be placed might be different if you have installed the Python environment in a different location than in the example above.

  1. Obtain the QuTiP source code and installed it following the instructions given above.

NOTE: In some cases, to get the dynamic compilation of Cython code to work, it might be necessary to edit the PATH variable and make sure that C:\MinGW32-xy\bin appears either first in the PATH list, or possibly right after C:\Python27\Lib\site-packages\PyQt4. This is to make sure that the right version of the MinGW compiler is used if more than one is installed (not uncommon under Windows, since many packages are distributed and installed with their own version of all dependencies).

Optional Installation Items

UMFPACK Linear Solver

As of SciPy 0.14+, the umfpack linear solver routines for solving large-scale sparse linear systems have been replaced due to licensing restrictions. The default method for all sparse linear problems is now the SuperLU library. However, scipy still includes the ability to call the umfpack library via the scikits.umfpack module. In our experience, the umfpack solver can be 2-5x faster than the SuperLU routines, which is a very noticeable performance increase when used for solving steady state solutions. An updated scikits.umfpack module available at http://github.com/rc/scikit-umfpack that can be installed to have SciPy find and use the umfpack library.

Optimized BLAS Libraries

QuTiP is designed to take advantage of some of the optimized BLAS libraries that are available for NumPy. At present, this includes the OPENBLAS and MKL libraries. If NumPy is built against these libraries, then QuTiP will take advantage of the performance gained by using these optimized tools.

Verifying the Installation

QuTiP includes a collection of built-in test scripts to verify that an installation was successful. To run the suite of tests scripts you must have the nose testing library. After installing QuTiP, leave the installation directory, run Python (or iPython), and call:

import qutip.testing as qt
qt.run()

If successful, these tests indicate that all of the QuTiP functions are working properly. If any errors occur, please check that you have installed all of the required modules. See the next section on how to check the installed versions of the QuTiP dependencies. If these tests still fail, then head on over to the QuTiP Discussion Board and post a message detailing your particular issue.

Checking Version Information Using the About Function

QuTiP includes an “about” function for viewing information about QuTiP and the important dependencies installed on your system. To view this information run:


In [2]:
from qutip import *
about()


QuTiP: Quantum Toolbox in Python
Copyright (c) 2011 and later.
Paul D. Nation & Robert J. Johansson

QuTiP Version:      3.2.0.dev-ad075c9
Numpy Version:      1.9.2
Scipy Version:      0.15.1
Cython Version:     0.22
Matplotlib Version: 1.4.3
Fortran mcsolver:   False
scikits.umfpack:    False
Python Version:     3.4.3
Platform Info:      Darwin (x86_64)
Installation path:  /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/qutip-3.2.0.dev_ad075c9-py3.4-macosx-10.10-x86_64.egg/qutip


In [3]:
from IPython.core.display import HTML
def css_styling():
    styles = open("styles/guide.css", "r").read()
    return HTML(styles)
css_styling()


Out[3]: