Installation Instructions¶
If you encounter bugs during installation email gpkit@mit.edu
,
or raise a new issue.
Install dependencies¶
GPkit’s dependencies are the python packages
pip
numpy
version 1.8 or newerscipy
pint
and at least one solver (which we will install in a later step).
There are many ways to install these dependencies. Below is one suggestion for how to do so.
Get pip
¶
- Mac OS X
- Run
easy_install pip
at 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
- Do nothing at this step.
Get python packages¶
- Mac OS X
- Run the following commands:
pip install pip --upgrade
pip install numpy
pip install scipy
pip install pint
- Linux
- Use your package manager to install
numpy
andscipy
- Ubuntu:
sudo apt-get install python-numpy python-scipy
Run
pip install pint
- Use your package manager to install
- Windows
- Do nothing at this step.
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.
Unfortunately, on Windows, due to 32-bit vs 64 bit issues, we do not currently know of a way to install both cvxopt and mosek simultaneously. If you are a Windows user, you should pick one solver or the other. For Windows 10, cvxopt does not appear to be an option.
Installing cvxopt¶
- Mac OSX and Linux
- Run
pip install cvxopt
- Windows
If you are using Windows 10, stop. Go to Installing mosek.
- Install the Python 2.7 version of Python (x,y) (note that Python (x,y) is 32-bit)
- Installing CVXOPT with Anaconda or another Python distribution can be difficult, which is why we recommend Python (x,y).
- Python (x,y) recommends removing any previous installations of Python before installation.
- Be sure to click the cvxopt and pint check boxes under “Choose components” during installation.
Installing mosek¶
Note: if you do not have a paid license, you will need an academic or trial license to proceed.
- Mac OS X
If
which gcc
does not return anything, installXCode
and the Apple Command Line Tools.Install cytypesgen via
pip install ctypesgen --pre
(gpkit uses ctypesgen to interface with the MOSEK C bindings).- Download MOSEK, then:
- Move the
mosek
folder to your home directory - Follow these steps for Mac.
- Request an academic license file and put it in
~/mosek/
- Move the
- Linux
Install cytypesgen via
pip install ctypesgen --pre
(gpkit uses ctypesgen to interface with the MOSEK C bindings).- Download MOSEK, then:
- Move the
mosek
folder to your home directory - Follow these steps for Linux.
- Request an academic license file and put it in
~/mosek/
- Move the
- Windows
If you have a 32-bit version of Windows, stop. Go to Installing cvxopt.
Install the 64-bit version of Anaconda.
Install cytypesgen via
pip install ctypesgen --pre
(gpkit uses ctypesgen to interface with the MOSEK C bindings).- 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 of mingw. - Make sure the
mingw
bin directory is on your system path (you may have to add it manually).
- To do this, type
- Make sure
Install GPkit¶
- Run
pip install gpkit
at the command line.- Run
pip install ipywidgets
for interactive control of models (recommended)- Run
python -c "import gpkit.tests; gpkit.tests.run()"
- Optional: to install gpkit into an isolated python environment, install virtualenv, run
virtualenv $DESTINATION_DIR
then activate it withsource $DESTINATION_DIR/bin/activate
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.
- You see
Could not load MOSEK library: ImportError('$HOME/.gpkit/expopt.so not found.')
- To rebuild GPkit, do 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, email
gpkit@mit.edu
- Run
Updating GPkit between releases¶
Active developers may wish to install the latest GPkit directly from the source code on Github. To do so,
- Run
pip uninstall gpkit
to uninstall your existing GPkit.- Run
git clone https://github.com/hoburg/gpkit.git
to clone the GPkit repository, orcd gpkit; git pull origin master; cd ..
to update your existing repository.- Run
pip install -e gpkit
to reinstall GPkit.- Run
python -c "import gpkit.tests; gpkit.tests.run()"
to test your installation.