Installation Instructions¶
If you encounter any bugs during installation, please email gpkit
at mit.edu
.
Mac OS X¶
1. Install Python and build dependencies¶
Install the Python 2.7 version of Anaconda. - Check that Anaconda is installed: in a Terminal window, run
python
and check that the version string it prints while starting includes “Anaconda”.
- If it does not, check that the Anaconda location in
.profile
in your home directory (you can runvim ~/.profile
to read it) corresponds to the location of your Anaconda folder; if it doesn’t, move the Anaconda folder there, and check again in thepython
startup header.If you don’t want to install Anaconda, you’ll need gcc, pip, numpy, and scipy, and may find iPython Notebook useful as a modeling environment.
If
which gcc
does not return anything, install the Apple Command Line Tools.Optional: to install gpkit into an isolated python environment you can create a new conda virtual environment with
conda create -n gpkit anaconda
and activate it withsource activate gpkit
.
2. Install either the MOSEK or CVXOPT GP solvers¶
- Download CVXOPT, then:
- Read the official instructions and requirements
- In the Terminal, navigate to the
cvxopt
folder- Run
python setup.py install
- 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/
- Run
pip install ctypesgen --pre
in the Terminal (gpkit uses ctypesgen to interface with the MOSEK C bindings)
3. Install GPkit¶
- Run
pip install gpkit
at the command line.- Run
pip install ipywidgets
for interactive control of models (optional)- Run
python -c "import gpkit.tests; gpkit.tests.run()"
- If you want units support, install pint with
pip install pint
.
Linux¶
1. Install either the MOSEK or CVXOPT GP solvers¶
- Download CVXOPT, then:
- Read the official instructions and requirements
- In a terminal, navigate to the
cvxopt
folder- Run
python setup.py install
- 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/
- Run
pip install ctypesgen --pre
(gpkit uses ctypesgen to interface with the MOSEK C bindings)
2. Install GPkit¶
- _Optional:_ to install gpkit into an isolated python environment, install virtualenv, run
virtualenv $DESTINATION_DIR
then activate it withsource $DESTINATION_DIR/bin/activate
.- Run
pip install gpkit
at the command line.- Run
pip install ipywidgets
for interactive control of models (optional)- Run
python -c "import gpkit.tests; gpkit.tests.run()"
- If you want units support, install pint with
pip install pint
.- You may find iPython Notebook to be useful modeling environment.
Windows¶
1. Install Python dependencies¶
- Install the Python 2.7 version of Python (x,y).
- Python (x,y) recommends removing any previous installations of Python before installation.
- Make sure to check the cvxopt checkbox under “Choose components” during installation.
2. (optional) Install the MOSEK GP solver¶
- CVXOPT is included with Python (x,y) and does not need to be installed
- Installing CVXOPT with Anaconda or another Python distribution can be difficult, which is why we reccomend Python (x,y).
- Download MOSEK, then:
- Follow these steps for Windows.
- Request an academic license file and put it in
~/mosek/
- To use the MOSEK C bindings solver: - Make sure “gcc” is on your system path (that is, you can type
gcc
into a command prompt and not get “executable not found”) - Runpip install ctypesgen --pre
in the Command Prompt (gpkit uses ctypesgen to interface with the MOSEK C bindings)
3. Install GPkit¶
Run
pip install gpkit
at an Anaconda Command Prompt.Run
pip install ipywidgets
for interactive control of models (optional)
- Run
python -c "import gpkit.tests; gpkit.tests.run()"
- If attempting to run the tests results in
ValueError: Unknown solver ''.
andpython -c "import gpkit"
prints “Could not find settings file”, then runpython -c "import gpkit.build; gpkit.build.build_gpkit()"
, to look for and install solvers. After doing so (it should say which solvers have been found), runpython -c "import gpkit.tests; gpkit.tests.run()"
again.If you want units support, install pint with
pip install pint
.
Updating GPkit between releases¶
Active developers may wish to install the latest GPkit <http://github.com/hoburg/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.