Library / SDK
cvxpy/cvxpy avatar
cvxpy/cvxpy

CVXPY 1.9: A Modeling Layer for Convex Optimization That Leaves Solver Choice to You

CVXPY is a Python framework for convex optimization that converts high-level modeling problems into disciplined convex programs and helps choose solvers, tune constraints, and validate numeric results.

6,394 stars1,237 forksC++Apache-2.0

At a glance

What is it?
CVXPY is a Python-embedded modeling language that translates natural mathematical expressions into disciplined convex programs, then hands them to solvers like Clarabel, SCS, OSQP, or HiGHS. This review covers its mechanism, installation, limitations, and where it fits.
Who is it for?
Adopt CVXPY if you solve convex, mixed-integer convex, geometric, quasiconvex, or nonlinear programs in Python and want to express them in math-like syntax rather than solver-specific standard forms. Skip it if you need a solver itself, need to handle non-convex problems beyond the listed classes, or require fine-grained control over solver internals.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 1 day ago.
What is it written in?
Mainly C++, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 13, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • cvxpy/cvxpy6,394 ★ · +104
Star history
Repository2026-07-282026-11-13
cvxpy/cvxpy6.3k6.4k

104 Stars in the last 108 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What CVXPY Actually Solves

CVXPY is not a solver. The README states this directly. It is a Python-embedded modeling language for convex optimization problems. The problem it solves is the gap between how you think about an optimization problem and the restrictive standard forms that solvers require. Instead of reformulating your least-squares problem into a specific matrix format, you write the objective and constraints in a way that follows the math. The README's example defines a variable x, an objective cp.Minimize(cp.sum_squares(A @ x - b)), and constraints 0 <= x and x <= 1. That is the entire model. CVXPY then converts that high-level description into a disciplined convex program, which is a structured form that solvers can accept. The target audience is researchers, data scientists, software engineers, and students, per the README. If you work in operations research, finance, control, or machine learning, you have likely seen the pain of translating a clean mathematical formulation into a solver-specific input. CVXPY removes that step.

The Mechanism: From Math to DCP to Solver

The core mechanism is the conversion of a high-level problem into a disciplined convex program, or DCP. DCP is a set of rules that ensure a problem is convex. CVXPY checks your expressions against these rules. If your problem violates DCP, you get an error, and the README points users to StackOverflow for questions like "Why isn't my problem DCP?" This is a key design choice: CVXPY enforces convexity at the modeling level, not at the solver level. Once the problem passes DCP, CVXPY chooses a solver from the open source set it bundles: Clarabel, SCS, OSQP, and HiGHS. The README lists these as dependencies, so they come with the package. CVXPY also supports additional solvers, but they must be installed separately. The data flow is: you write a Python script, CVXPY builds a canonical representation, selects a solver, calls it, and returns the optimal value, the variable values, and dual values for constraints. The example shows that after prob.solve(), x.value holds the optimal variable and constraints[0].dual_value holds the Lagrange multiplier. That dual value is a concrete output, and it matters for sensitivity analysis.

Getting It Running: Commands and Dependencies

Installation is straightforward. The README gives two commands: pip install cvxpy and conda install -c conda-forge cvxpy. The package is on PyPI and conda-forge. The dependency list is explicit and somewhat demanding. You need Python >= 3.11, NumPy >= 2.0.0, SciPy >= 1.13.0, plus the solvers Clarabel >= 0.5.0, OSQP >= 1.0.0, SCS >= 3.2.4.post1, and highspy >= 1.11.0. There is also sparsediffpy >= 0.2.2. That version floor matters. If your environment is pinned to Python 3.10 or NumPy 1.x, you cannot install the current CVXPY. The README also points to an installation guide at cvxpy.org for detailed instructions. After installation, you import cvxpy as cp and start modeling. The example uses numpy.random to generate data, which means you need a working NumPy install alongside CVXPY. No separate solver configuration is needed for the bundled solvers; CVXPY picks one automatically, though the solver selection guide at cvxpy.org explains how to choose explicitly.

Limitations: What CVXPY Cannot Do

The most obvious limitation is that CVXPY only handles the problem classes listed in the README: convex, mixed-integer convex, geometric, quasiconvex, and nonlinear programs. It does not handle general non-convex optimization. If your objective or constraints are non-convex and do not fit those categories, CVXPY will reject them at the DCP check. Another limitation is that CVXPY is a modeling layer, not a solver. The README is explicit: "CVXPY is not a solver." That means the performance of your solution depends entirely on the solver it selects. If the bundled solvers are not suited to your problem size or structure, you must install additional solvers separately, which adds complexity. The README also notes that for basic usage questions, users should go to StackOverflow, which suggests that the DCP rule system can be opaque for newcomers. A third limitation is the dependency floor. The requirement for Python >= 3.11 and NumPy >= 2.0 means that CVXPY 1.9 is not for legacy environments. If you are stuck on an older Python, you will need an older CVXPY version, and that version may not have the latest features or fixes.

The Right Tool and the Wrong Tool

CVXPY is the right tool when your problem is convex and you want to iterate quickly on the model, not on the solver interface. The README's example is a bounded least-squares problem, and that is the sweet spot. You write the objective and constraints in a few lines, solve, and read off x.value and dual_value. It is also right for mixed-integer convex problems, geometric programs, quasiconvex programs, and nonlinear programs, because those are the classes it supports. It is the wrong tool when you have a non-convex problem that does not fit those classes. A typical example is a problem with a non-convex constraint like a product of two variables or a binary variable multiplied by a continuous variable in a non-convex way. CVXPY will reject it, and you will need a different approach, such as a general nonlinear solver like IPOPT or a heuristic. It is also the wrong tool if you need to ship a solver in a production system with minimal dependencies. CVXPY pulls in several solvers plus sparsediffpy, which is a heavy footprint. If you only need to solve a specific QP, using OSQP directly might be leaner.

Alternatives: How They Differ

The main alternative to CVXPY is to use a solver directly, such as OSQP or SCS, without a modeling layer. The difference is in the interface. With OSQP, you must formulate your problem in the solver's standard form, which is typically a quadratic program with a specific matrix structure. You manually construct the objective matrix P, the linear term q, and the constraint matrices A, l, and u. That is exactly the restrictive standard form that CVXPY removes. The trade-off is control. With a direct solver, you have full control over solver parameters, warm-starting, and the exact numerical path. With CVXPY, you delegate that to the modeling layer. Another alternative is a different modeling language, such as JuMP in Julia. The key difference in approach is that CVXPY centralizes the DCP conversion and solver selection, while direct solver usage puts that burden on you. If you have a single, well-understood problem, direct solver use may be faster. If you are exploring many formulations, CVXPY's abstraction saves time.

Maintenance and Licensing

CVXPY is under active development. The repository shows recent releases: v1.9.3 in September 2026, v1.9.2 in August 2026, and v1.9.1 in May 2026. That is three releases in about four months. The project is not archived, and the last push is recent. The README mentions a governance document, which suggests a structured maintenance process. The license is Apache-2.0. That is a permissive license, which means you can use, modify, and distribute CVXPY in commercial products, provided you include the license notice. The README does not specify any additional commercial restrictions. There is a citation request for academic use, but that is a request, not a license condition. The dependency on sparsediffpy and highspy is notable because those are less common, and their maintenance affects CVXPY. If those libraries lag, CVXPY's release schedule could be blocked. The README does not provide a migration guide or upgrade cost analysis, so you should check the release notes for breaking changes when upgrading between minor versions.

Editorial conclusion

Adopt CVXPY if you solve convex, mixed-integer convex, geometric, quasiconvex, or nonlinear programs in Python and want to express them in math-like syntax rather than solver-specific standard forms. Skip it if you need a solver itself, need to handle non-convex problems beyond the listed classes, or require fine-grained control over solver internals. Before committing, verify that your problem class is supported, that your Python version is at least 3.11, and that the bundled solvers (Clarabel, SCS, OSQP, HiGHS) cover your performance needs; check the solver selection guide at cvxpy.org to see if you need to install additional solvers separately.

Frequently asked questions

What is CVXPY used for?

It is a Python embedded modeling language for convex optimization problems, letting you write a problem in a form that follows the mathematics instead of the standard form solvers require. It covers convex problems plus mixed-integer convex, geometric, quasiconvex and nonlinear programs, and it is not a solver itself: it hands the problem to Clarabel, SCS, OSQP or HiGHS.

How do I find the optimal value in CVXPY?

The solve call on your problem object returns the optimal objective value, the variable holds its own optimal value, and each constraint holds the optimal Lagrange multiplier as its dual value. The readme's own least squares example prints all three, so a constraint object is where a shadow price comes from rather than something you request separately.

What does the CVXPY status infeasible mean?

The readme does not define the status strings that a solve reports. Its example only reads the returned objective, the variable value and a constraint's dual value, and sends questions about why a problem is not compliant to a stack overflow tag. The API reference linked from the getting started section is the place to look for status values.

Which solvers come with CVXPY and which do not?

Clarabel, SCS, OSQP and HiGHS are the open source solvers the project relies on, with minimum versions of 0.5.0, 3.2.4.post1, 1.0.0 and 1.11.0 respectively. Additional solvers are available but must be installed separately, and optional ones appear in the repository as pytest markers, such as the knitro marker for tests that load a native runtime in its own process.

What does CVXPY require to install?

Python 3.11 or later, and it installs from PyPI with pip install cvxpy or from conda-forge with conda install -c conda-forge cvxpy. The readme lists Clarabel, OSQP, SCS, NumPy, SciPy, highspy and sparsediffpy with minimum versions, while the requirements file at the root lists only five of them without any version constraints and omits highspy and sparsediffpy.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/cvxpy-cvxpy.svg)](https://hysenlabs.com/projects/cvxpy-cvxpy)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/cvxpy-cvxpy.svg)](https://hysenlabs.com/projects/cvxpy-cvxpy)

Was this useful?