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.
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 2 days 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 September 14, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE 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 that many modeling tools omit, 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, which is a sparse differentiation library. 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 and a sparse differentiation library, 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, but the README does not mention it, so I cannot compare directly. 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.2 in August 2026, v1.9.1 in May 2026, and v1.9.0 in May 2026. That is a steady cadence of roughly three releases in three 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.
Community notes