CVXPY supports Python 3 on Linux, macOS, and Windows. You can use pip or conda for installation. You may want to isolate your installation in a virtualenv, or a conda environment.


(Windows only) Download the Visual Studio build tools for Python 3 (instructions).

(macOS only) Install the Xcode command line tools.

(optional) Create and activate a virtual environment.

Install CVXPY using pip:

pip install cvxpy

You can add solver names as “extras”; pip will then install the necessary additional Python packages.


conda is a system for package and environment management.

(Windows only) Download the Visual Studio build tools for Python 3.

  1. Install conda.

  2. Create a new conda environment,

conda create --name cvxpy_env
conda activate cvxpy_env

or activate an existing one

  1. Install cvxpy from conda-forge

    conda install -c conda-forge cvxpy

We strongly recommend using a fresh virtual environment (virtualenv or conda) when installing CVXPY from source.

CVXPY has the following dependencies:

All required packages are installed automatically alongside CVXPY.

Perform the following steps to install CVXPY from source:

  1. Clone the official CVXPY git repository, or a newly minted fork of the CVXPY repository.

  2. Navigate to the top-level of the cloned directory.

  3. If you want to use CVXPY with editable source code, run

    pip install -e .

    otherwise, run

    pip install .

We provide support for GitHub Codespaces with preconfigured environments for CVXPY development via devcontainers. To get started, click the “Code” button on the CVXPY repository and select “Open with Codespaces”.


Apple M1 users have had trouble installing CVXPY using the commands above. That trouble stemmed partly from a configuration error in CVXPY’s pyproject.toml, which has been fixed in CVXPY 1.1.19 and 1.2.0. If you have those versions (or newer) then the above commands should work provided (1) you have cmake installed via Homebrew and (2) you have an ECOS 2.0.5 wheel. The cmake requirement stems from OSQP and there appear to be problems building more recent versions of ECOS on M1 machines. See this comment on the CVXPY repo and this issue on the ECOS repo for more information.

Install with Additional Solver Support

Running the test suite

CVXPY comes with an extensive test suite, which can be run after installing pytest. If installed from source, navigate to the root of the repository and run


To run the tests when CVXPY was not installed from source, use

pytest --pyargs cvxpy.tests