Installation Instructions¶
If you encounter bugs during installation, please email gpkit@mit.edu
or raise a GitHub issue.
Installation dependencies¶
To install GPkit, you’ll need to have the following python packages already installed on your system:
pipnumpyversion 1.8.1 or newerscipypint
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 pipat a terminal window. - Linux
- Use your package manager to install
pip - Ubuntu:
sudo apt-get install python-pip
- Use your package manager to install
- Windows
- Install the Python 2.7 64-bit version of Anaconda.
Get python packages¶
- Mac OS X
- Run the following commands:
pip install pip --upgradepip install numpypip install scipypip install pint
- Linux
- Use your package manager to install
numpyandscipy - Ubuntu:
sudo apt-get install python-numpy python-scipy
Run
pip install pint(for system python installs, usesudo pip)- Use your package manager to install
- Windows
- 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¶
- Mac OSX
- Run
pip install cvxopt - Linux
Run
sudo apt-get install libblas-dev liblapack-dev libsuitesparse-devor otherwise install those librariesRun
pip install cvxopt(for system python installs, usesudo pip)If experiencing issues with wheel in Ubuntu 16.04, try the official installer.
- Windows
- Run
conda install -c omnia cvxoptin 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
- If
which gccdoes not return anything, installXCodeand the Apple Command Line Tools. - Install ctypesgen with
pip install ctypesgen --pre. - Download MOSEK, then:
- Move the
mosekfolder to your home directory - Follow these steps for Mac.
- Request an academic license file and put it in
~/mosek/
- Move the
- If
- Linux
- Install ctypesgen with
pip install ctypesgen --pre(for system python installs, usesudo pip) - Download MOSEK, then:
- Move the
mosekfolder to your home directory - Follow these steps for Linux.
- Request an academic license file and put it in
~/mosek/
- Move the
- Install ctypesgen with
- Windows
- Install ctypesgen by running
pip install ctypesgen --prein 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
gccis on your system path. - To do this, type
gccinto 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
mingwbin directory is on your system path (you may have to add it manually).
- To do this, type
- Make sure
- Install ctypesgen by running
Install GPkit¶
- Run
pip install gpkitat the command line (for system python installs, usesudo pip)- Run
pip install jupyterto install jupyter notebook (recommended)- Run
jupyter nbextension enable --py widgetsnbextensionfor interactive control of models in jupyter (recommended)- Run
python -c "import gpkit.tests; gpkit.tests.run()"to run the tests; if any tests do not pass, please emailgpkit@mit.eduor 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
.gpkitfolder from your home directory - You see
Could not load settings file.when importing GPkit, or Could not load MOSEK library: ImportError('$HOME/.gpkit/expopt.so not found.')
- To rebuild GPkit, first try running
python -c "from gpkit.build 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; gpkit.tests.run()" - If any tests fail, please email
gpkit@mit.eduor raise a GitHub issue.
- Run
Bleeding-edge / developer installations¶
Active developers may wish to install the latest GPkit directly from the source code on Github. To do so,
- Run
pip uninstall gpkitto uninstall your existing GPkit.- Run
git clone https://github.com/convexengineering/gpkit.gitto clone the GPkit repository.- Run
pip install -e gpkitto install that directory as your environment-wide GPkit.- Run
cd ..; python -c "import gpkit.tests; gpkit.tests.run()"to test your installation from a non-local directory.