{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#Installation\n", "\n", "###Contents\n", "\n", "- [General Requirements](#require)\n", "- [Basic Installation](#independent)\n", "- [Installing From Source](#source)\n", "- [Installation on Ubuntu Linux](#linux)\n", "- [Installation on Mac OSX](#mac)\n", "- [Installation on Windows](#win)\n", "- [Optional Installation Items](#optional)\n", "- [Verifying Installation](#verify)\n", "- [Checking Version Information](#about)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##General Requirements\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
PackageVersionDetails
Python2.7+Version 3.4+ is highly recommended
Numpy1.7+
SciPy0.14+Lower versions are missing features.
Matplotlib1.2.0+Lower versions are missing features.
Cython0.21+Needed for compiling some time-dependent Hamiltonians.
GCC4.4+Needed for compiling Cython files.
GFORTRAN4.4+Optional, needed for compiling the Fortran-based Monte Carlo solver.
BLAS1.2+Optional, Linux only. Needed for installing Fortran Monte Carlo solver.
Mayavi4.1+Optional. Needed for using the Bloch3d class.
Python Headers2.7+Linux only. Needed for compiling Cython files.
LaTeXTexLive 2009+Optional. Needed if using LaTeX in Matplotlib figures.
Nose1.1.2+Optional. For running tests.
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Platform-Independent Installation \n", "\n", "Often the easiest way is to install QuTiP is to use the Python package manager pip.\n", "\n", "```bash\n", "pip install qutip\n", "```\n", "\n", "Or, optionally, to also include the Fortran-based Monte Carlo solver:\n", "\n", "```bash\n", "pip install qutip --install-option=--with-f90mc\n", "```\n", "\n", "More detailed platform-dependent installation alternatives are given below." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Installing From Source\n", "\n", "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.\n", "\n", "Regardless of platform, to install QuTiP from the source code run:\n", "\n", "```bash\n", "sudo python setup.py install\n", "```\n", "\n", "To also include the optional Fortran Monte Carlo solver, run:\n", "\n", "```bash\n", "sudo python setup.py install --with-f90mc\n", "```\n", "\n", "On Windows, omit `sudo` from the commands given above." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Installation on Ubuntu Linux (recommended)\n", "\n", "###Using QuTiP’s PPA\n", "\n", "The easiest way to install QuTiP in Ubuntu (14.04 and later) is to use the QuTiP PPA\n", "\n", "```bash\n", "sudo add-apt-repository ppa:jrjohansson/qutip-releases\n", "sudo apt-get update\n", "sudo apt-get install python-qutip\n", "```\n", "\n", "A Python 3 version is also available, and can be installed using:\n", "\n", "```bash\n", "sudo apt-get install python3-qutip\n", "```\n", "\n", "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:\n", "\n", "```bash\n", "sudo apt-get install texlive-latex-extra\n", "```\n", "\n", "###Manual Installation of Dependencies\n", "\n", "First install the required dependencies using:\n", "\n", "```bash\n", "sudo apt-get install python-dev cython python-setuptools python-nose\n", "sudo apt-get install python-numpy python-scipy python-matplotlib\n", "```\n", "\n", "Then install QuTiP from source following the instructions given above.\n", "\n", "Alternatively (or additionally), to install a Python 3 environment, use:\n", "\n", "```bash\n", "sudo apt-get install python3-dev cython3 python3-setuptools python3-nose\n", "sudo apt-get install python3-numpy python3-scipy python3-matplotlib\n", "```\n", "\n", "and then do the installation from source using python3 instead of python.\n", "\n", "Optional, but recommended, dependencies can be installed using:\n", "```bash\n", "sudo apt-get install texlive-latex-extra \n", "sudo apt-get install libblas-dev \n", "sudo apt-get install liblapack-dev \n", "sudo apt-get install gfortran\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Installation on Mac OSX (10.8+)\n", "\n", "###Setup Using Homebrew\n", "\n", "The latest version of QuTiP can be quickly installed on OS X using Homebrew and the automated installation shell scripts\n", "\n", "[Python 2.7 script](https://raw.github.com/qutip/qutip/master/mac/install_qutip_py2.sh) | [Python 3.4 script](https://raw.github.com/qutip/qutip/master/mac/install_qutip_py3.sh)\n", "\n", "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)\n", "\n", "```bash\n", "sh install_qutip_pyX.sh\n", "```\n", "\n", "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.\n", "\n", "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.\n", "\n", "###Setup Using Macports\n", "\n", "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’.\n", "\n", "On the Mac OS, you can install the required libraries via [MacPorts](http://macports.org). After installation, the necessary “ports” for QuTiP may be installed via (Replace ‘34’ with ‘27’ if you want Python 2.7)\n", "\n", "```bash\n", "sudo port install py34-scipy\n", "sudo port install py34-matplotlib +latex\n", "sudo port install py34-cython\n", "sudo port install py34-ipython +notebook+parallel\n", "sudo port install py34-pip\n", "```\n", "Now, we want to tell OS X which Python and iPython we are going to use\n", "\n", "```bash\n", "sudo port select python python34\n", "sudo port select ipython ipython34\n", "sudo port select pip pip34\n", "```\n", "\n", "To install QuTiP, run\n", "\n", "```bash\n", "sudo pip install qutip --install-option=--with-f90mc\n", "```\n", "\n", "###Anaconda CE Distribution\n", "\n", "Finally, one can also use the [Anaconda](http://continuum.io/downloads.html) package to install all of the QuTiP dependencies and then install QuTiP from the source package." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Installation on Windows\n", "\n", "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:\n", "\n", "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.\n", "\n", "1. When installing Python(x,y), explicitly select to include the Cython package in the installation. This package is not selected by default.\n", "\n", "1. Add the following content to the file `C:/Python27/Lib/distutils/distutils.cfg` (or create the file if it does not already exists):\n", "\n", "```bash\n", "[build]\n", "compiler = mingw32\n", "\n", "[build_ext]\n", "compiler = mingw32\n", "```\n", "\n", "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.\n", "\n", "
    \n", "
  1. Obtain the QuTiP source code and installed it following the instructions given above.
  2. \n", "
\n", "\n", "**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)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Optional Installation Items\n", "\n", "###UMFPACK Linear Solver\n", "\n", "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.\n", "\n", "###Optimized BLAS Libraries\n", "\n", "QuTiP is designed to take advantage of some of the optimized BLAS libraries that are available for NumPy. At present, this includes the [OPENBLAS](http://www.openblas.net/) and [MKL](http://software.intel.com/en-us/intel-mkl) libraries. If NumPy is built against these libraries, then QuTiP will take advantage of the performance gained by using these optimized tools." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Verifying the Installation\n", "\n", "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:\n", "\n", "```python\n", "import qutip.testing as qt\n", "qt.run()\n", "```\n", "\n", "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." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Checking Version Information Using the About Function\n", "\n", "QuTiP includes an “about” function for viewing information about QuTiP and the important dependencies installed on your system. To view this information run:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "QuTiP: Quantum Toolbox in Python\n", "Copyright (c) 2011 and later.\n", "Paul D. Nation & Robert J. Johansson\n", "\n", "QuTiP Version: 3.2.0.dev-ad075c9\n", "Numpy Version: 1.9.2\n", "Scipy Version: 0.15.1\n", "Cython Version: 0.22\n", "Matplotlib Version: 1.4.3\n", "Fortran mcsolver: False\n", "scikits.umfpack: False\n", "Python Version: 3.4.3\n", "Platform Info: Darwin (x86_64)\n", "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\n", "\n" ] } ], "source": [ "from qutip import *\n", "about()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from IPython.core.display import HTML\n", "def css_styling():\n", " styles = open(\"styles/guide.css\", \"r\").read()\n", " return HTML(styles)\n", "css_styling()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.4.3" } }, "nbformat": 4, "nbformat_minor": 0 }