CVXOPT Description

CVXOPT is a Python-based front-end to a variety of convex and conic optimization solvers. CVXOPT is less flexible, but more efficient than CVX. It also exposes an interface to customize the linear algebra routines used within the conic solvers so that one can create highly efficient, specialized interior point methods for certain problems. See their website for more details.

The standard installation comes with some open-source solvers. These open-source solvers will be sufficient for the Software Tools Class. Consult the CVXOPT documentation for instructions on adding additional solvers to your installation.

Installation Instructions.

Linux users have separate (and simpler) instructions here.

Obtain Python 2.7 with Numpy and Scipy

CVXOPT requires Python 2.7 equipped with various packages for linear algebra, including Numpy and Scipy. If you know what you're doing and already have Python2.7 installed with Numpy and Scipy, you can skip this step.

Otherwise, we HIGHLY recommend installing EPD Python2.7, 32-bit. (Note this is different from the version of Python suggested in the "Modeling Linear Optimization Problems with PulP" session. This is a stable-version of Python that ships with lots and lots of packages already installed, including most numerical and scientific packages you'd ever want to use as a researcher. See http://www.enthought.com/products/epd.php for details. The total installation is a little large (because it has so many packages), but most of the stuff is pretty useful. It is also the simplest way to get all the dependencies right.

To install EPD Python2.7, 32-bit:

Warning On Windows and Mac OS X, the EPD installation has an annoying feature whereby it will change your system's default Python version to the version it installs. Many users don't like this. (I personally do not mind and have not bothered to change it back). If you do want restore the defaults, though, make a note of what your default python is before installing. For example, on Mac OSX you would, Open a Terminal and type:
$which python
Save the output for later. Close the terminal.
If you are on Windows, do nothing for now.

After that, to install EPD Python,

  1. Go to http://epd-free.enthought.com/?Download=Download+EPD+Free+7.3-2
  2. Select the installer for your OS and download it.
  3. Follow the installation instructions. Defaults are usually fine. Make note of where it is installing Python.

After you are finished, if you like, you can change back the default interpreter to the one it was before EPD was installed. If you're not bothered about this, skip this step. Otherwise, follow the appropriate instructions:

Install CVXOPT for Windows

While it is possible to build CVXOPT from source, we have not yet tested/tried this. Any experience from users who are willing to try is welcome in the comments section.

Instead, please download and install from binary.

  1. Go to this download page
  2. Select "Archive" under "Older Versions."
  3. Under "Win32-binaries" select "cvxopt_1.1.4" for either python2.7 or python3.2 as appropriate.
  4. The downloaded file is an ordinary windows installer. Double-click and install as you would any other windows program.

Install CVXOPT for Mac OS X

While it is possible to install CVXOPT from a binary as described above, we have not tested/tried this. Any experience from users who are willing to try are welcome in the comments section.

Otherwise, please build CVXOPT from source.

  1. Check to make sure you have the gcc compiler by opening a terminal and typing

    $ gcc

    If you get a "no input files" type error, you're great. Go to next step. If you get a "command not found" type error, you don't have the GCC compiler and need to install it. This is generally a good idea anyway. If you know what you're doing, feel free to download the GCC compiler via HomeBrew or some other method. Otherwise:
    1. If you have OS X 10.6...
      1. Go to Github here: https://github.com/kennethreitz/osx-gcc-installer
      2. About halfway down the page is a pkg installer called: OS X 10.6 Snow Leopard: GCC-10.6.pkg Select it and install the GCC compiler as you would any other program
    2. If you have OS X 10.7, you have two options:
      1. Go to the github site: https://github.com/kennethreitz/osx-gcc-installer
      2. About halfway down the page is a pkg installer for OS X 10.7 Lion: GCC-10.7.pkg Select it and install the GCC compiler as you would any other program.
      3. Alternatively, you can go to to https://developer.apple.com/xcode/ to upgrade to/download the latest version of Xcode
        1. Open Xcode
        2. Go to the Menu Xcode -> Preferences and Select the Downloads Tab. Inside the Downloads Tab, install "Command Line Tools."
    3. If you have OS X 10.8, you have two options:
      1. (Preferred) Follow the instructions under 10.7 that downloads the latest version of XCode.
      2. (Untested) Download and use the 10.7 pkg installer from GitHub. Some forums on the internet seem to suggest this will work, but it is untested. Follow this route at your own risk.
    4. Regardless of which route you follow, once you've installed the GCC Compiler, open a NEW terminal, and try running GCC again.
  2. If you downloaded the EPD version of Python described above, Continue to Step 4.
  3. If you are using a different version of python, you must ensure your python installation includes all the requisite dependencies listed here . As far as we currently know, it is sufficient to have built numpy and scipy from source.
  4. Download the gzipped tar file
  5. Unpack it somewhere convenient. You will want to remember where this folder is as all the examples and documentation will be kept here.
  6. Once it has unpacked, from a terminal go to <your folder>/src
  7. Run the command: python setup.py install --user
    1. If you were one of the people who changed their default version of python back to something non-EPD, include the full path in this last command, i.e.:
      <Path to EPD Python Installation>/python setup.py install --user

This should invoke the GCC compiler and build CVXOPT.  Remember, you need to run this last command with EPD Python.  Hence, if you were one of the people who changed their default version of python back to something that wasn't EPD, include the full-path to EPD n the last comand.  

When it is complete, you can test your installation.

Testing your Installation

Don't forget to test your installation

Questions, Comments and Common Problems

If you come across an error in these installation instructions, please

  • Email the session leader
  • If you are certain about the correction, please edit this Wiki document appropriately. Remember to include all pertinent details including any OS or version info.
  • If you are not certain about the correction, start a comment thread on this page to discuss.
  • No labels