Install Guide¶
Mac OS X¶
The following instructions assume you already have Python installed. CVXPY supports both Python 2 and Python 3.
Install the Command Line Tools for Xcode.
Download from the Apple developer site.
If you don’t have
pip
installed, follow the instructions here to install it.Install
numpy
withpip
from the command-line.pip install numpy
Install
cvxpy
withpip
from the command-line.pip install cvxpy
Test the installation with
nose
.
pip install nose nosetests cvxpy
Ubuntu 14.04¶
The following instructions are for installing CVXPY with Python 2. To install CVXPY with Python 3, simply install the Python 3 version of all the packages.
- Make sure
apt-get
is up-to-date.
sudo apt-get update
Install
ATLAS
andgfortran
(needed forSCS
).sudo apt-get install libatlas-base-dev gfortran
Install
python-dev
.sudo apt-get install python-dev
Install
pip
.sudo apt-get install python-pip
Install
numpy
andscipy
.sudo apt-get install python-numpy python-scipy
Install
cvxpy
.sudo pip install cvxpy
or to install locally
pip install --user cvxpy
- Install
nose
.
sudo apt-get install python-nose
- Test the installation with
nose
.
nosetests cvxpy
Windows¶
Here is a step-by-step guide to installing CVXPY on a Windows machine.
- If you have Python installed already, it’s probably a good idea to remove it first. (Sorry!)
- Download the latest version of Python(x,y).
- Install Python(x,y). When prompted to select optional components, make sure to check cvxopt and cvxpy, as shown below.
4. To test the cvxpy installation, open Python(x,y) and launch the interactive console (highlighted button in the picture). This will bring up a console.
5. From the console, run “nosetests cvxpy”. If all the tests pass, your installation was successful.
Other Platforms¶
The CVXPY installation process on other platforms is less automated and less well tested. Check this page for instructions for your platform.
Install from source¶
CVXPY has the following dependencies:
- Python 2.7 or Python 3.4
- setuptools >= 1.4
- toolz
- CVXOPT >= 1.1.6
- ECOS >= 1.0.3
- SCS >= 1.0.1
- NumPy >= 1.8
- SciPy >= 0.13
To test the CVXPY installation, you additionally need Nose.
CVXPY automatically installs ECOS, CVXOPT, SCS, and toolz. NumPy and SciPy will need to be installed manually. Once you’ve installed NumPy and SciPy, installing CVXPY from source is simple:
Clone the CVXPY git repository.
Navigate to the top-level of the cloned directory and run
python setup.py install
Install with GLPK support¶
CVXPY supports the GLPK solver, but only if CVXOPT is installed with GLPK bindings. To install CVXPY and its dependencies with GLPK support, follow these instructions:
Install GLPK. We recommend either installing the latest GLPK from source or using a package manager such as apt-get on Ubuntu and homebrew on OS X.
Install CVXOPT with GLPK bindings.
CVXOPT_BUILD_GLPK=1 CVXOPT_GLPK_LIB_DIR=/path/to/glpk-X.X/lib CVXOPT_GLPK_INC_DIR=/path/to/glpk-X.X/include pip install cvxopt
Follow the standard installation procedure to install CVXPY and its remaining dependencies.