Installation¶
- If you are on Mac or Windows, we recommend installing Anaconda. Alternatively, install pip and create a virtual environment.
- (optional) Install the MOSEK 9 solver with
pip install Mosek, then a license as described below - (optional) Install the MOSEK 8 solver as described below
- Run
pip install gpkitin the appropriate terminal or command prompt. - Open a Python prompt and run
import gpkitto finish installation and run unit tests.
If you encounter any bugs please email gpkit@mit.edu
or raise a GitHub issue.
Installing MOSEK 8¶
GPkit interfaces with two off the shelf solvers: cvxopt, and MOSEK (versions 8 and 9).
Cvxopt is open source and installed by default; MOSEK requires a commercial licence or (free)
academic license. In MOSEK version 8 GPkit uses the command-line interface mskexpopt solver, while
in MOSEK 9 it uses the more active exponential-cone interface (and hence supports Choice Variables).
- Mac OS X
- If
which gccdoes not return anything, install the Apple Command Line Tools. - Download MOSEK 8, then:
- Move the
mosekfolder to your home directory - Follow these steps for Mac.
- Move the
- Request an academic license file and put it in
~/mosek/
- If
- Linux
- Download MOSEK 8, then:
- Move the
mosekfolder to your home directory - Follow these steps for Linux.
- Move the
- Request an academic license file and put it in
~/mosek/
- Windows
- 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) with GCC version 6.4.0 or older of mingw. - In an Anaconda command prompt (or equivalent), run
cd C:\Program Files\mingw-w64\x86_64-6.4.0-posix-seh-rt_v5-rev0\(or whatever corresponds to the correct installation directory; note that if mingw is inProgram Files (x86)instead ofProgram Filesyou’ve installed the 32-bit version by mistake) - Run
mingw-w64to add it to your executable path. For step 3 of the install process you’ll need to runpip install gpkitfrom this prompt.
- To do this, type
- Make sure
- Download MOSEK 8, then:
- Follow these steps for Windows.
- Request an academic license file and put it in
C:\Users\(your_username)\mosek\
Debugging your installation¶
- You may need to rebuild GPkit if any of the following occur:
- You install MOSEK after installing GPkit
- You see
Could not load settings file.when importing GPkit, or Could not load MOSEK library: ImportError('expopt.so not found.')
To rebuild GPkit run python -c "from gpkit.build import rebuild; rebuild()".
- If that doesn’t solve your issue then try the following:
pip uninstall gpkitpip install --no-cache-dir --no-deps gpkitpython -c "import gpkit.tests; gpkit.tests.run()"- If any tests fail, please email
gpkit@mit.eduor raise a GitHub issue.
Bleeding-edge installations¶
Active developers may wish to install the latest GPkit directly from Github. To do so,
pip uninstall gpkitto uninstall your existing GPkit.git clone https://github.com/convexengineering/gpkit.gitpip install -e gpkitto install that directory as your environment-wide GPkit.cd ..; python -c "import gpkit.tests; gpkit.tests.run()"to test your installation from a non-local directory.