Installation Instructions

If you encounter bugs during installation, please email or raise a GitHub issue.

Installation dependencies

To install GPkit, you’ll need to have the following python packages already installed on your system:

  • pip
  • numpy version 1.8.1 or newer
  • scipy
  • pint

and at least one solver, which we’ll choose and install in a later step.

There are many ways to install these dependencies, but here’s our suggestion:

Get pip

Mac OS X
Run easy_install pip at a terminal window.
Use your package manager to install pip
Ubuntu: sudo apt-get install python-pip
Install the Python 2.7 64-bit version of Anaconda.

Get python packages

Mac OS X
Run the following commands:
  • pip install pip --upgrade
  • pip install numpy
  • pip install scipy
  • pip install pint
Use your package manager to install numpy and scipy
Ubuntu: sudo apt-get install python-numpy python-scipy

Run pip install pint (for system python installs, use sudo pip)

Do nothing at this step; Anaconda already has the needed packages.

Install a GP solver

GPkit interfaces with two off the shelf solvers: cvxopt, and mosek. Cvxopt is open source; mosek requires a commercial licence or (free) academic license.

At least one solver is required.

Installing cvxopt

Run pip install cvxopt

Run sudo apt-get install libblas-dev liblapack-dev libsuitesparse-dev or otherwise install those libraries

Run pip install cvxopt (for system python installs, use sudo pip)

If experiencing issues with wheel in Ubuntu 16.04, try the official installer.

Run conda install -c omnia cvxopt in an Anaconda Command Prompt.

Installing mosek

Dependency note: GPkit uses the python package ctypesgen to interface with the MOSEK C bindings.

Licensing note: if you do not have a paid license, you will need an academic or trial license to proceed.

Mac OS X
  • Install ctypesgen with pip install ctypesgen --pre (for system python installs, use sudo pip)

  • Download MOSEK, then:
  • Install ctypesgen by running pip install ctypesgen --pre in an Anaconda Command Prompt .

  • Download MOSEK, then:
    • Follow these steps for Windows.

    • Request an academic license file and put it in C:\Users\(your_username)\mosek\

    • Make sure gcc is on your system path.
      • To do this, type gcc into a command prompt.
      • If you get executable not found, then install the 64-bit version (x86_64 installer architecture dropdown option) of mingw.
      • Make sure the mingw bin directory is on your system path (you may have to add it manually).

Install GPkit

  • Run pip install gpkit at the command line (for system python installs, use sudo pip)
  • Run pip install jupyter to install jupyter notebook (recommended)
  • Run jupyter nbextension enable --py widgetsnbextension for interactive control of models in jupyter (recommended)
  • Run python -c "import gpkit.tests;" to run the tests; if any tests do not pass, please email or raise a GitHub issue.
  • Join our mailing list and/or chatroom for support and examples.

Debugging installation

You may need to rebuild GPkit if any of the following occur:
  • You install a new solver (mosek or cvxopt) after installing GPkit
  • You delete the .gpkit folder from your home directory
  • You see Could not load settings file. when importing GPkit, or
  • Could not load MOSEK library: ImportError('$HOME/.gpkit/ not found.')
To rebuild GPkit, first try running python -c "from import rebuild; rebuild()". If that doesn’t work then try the following:
  • Run pip uninstall gpkit
  • Run pip install --no-cache-dir --no-deps gpkit
  • Run python -c "import gpkit.tests;"
  • If any tests fail, please email or raise a GitHub issue.

Bleeding-edge / developer installations

Active developers may wish to install the latest GPkit directly from the source code on Github. To do so,

  1. Run pip uninstall gpkit to uninstall your existing GPkit.
  2. Run git clone to clone the GPkit repository.
  3. Run pip install -e gpkit to install that directory as your environment-wide GPkit.
  4. Run cd ..; python -c "import gpkit.tests;" to test your installation from a non-local directory.