qpsolvers
Quadratic programming solvers in Python with a unified API.
What it is and what it does
qpsolvers is a wrapper library that provides a single `solve_qp` function to solve convex quadratic programs with multiple backend solvers. It abstracts away the differences between solvers like OSQP, ProxQP, Clarabel, and others, allowing you to write solver-agnostic code and switch backends by changing a keyword argument. The library accepts problem matrices as NumPy arrays (for dense solvers) or SciPy CSC sparse matrices (for sparse solvers), and returns the optimal solution vector or None if the problem is infeasible.
The package also offers a `solve_problem` function that returns not just the primal solution but also dual multipliers and other solver-computed quantities. It supports standard QP form with linear inequality constraints (Gx ≤ h), equality constraints (Ax = b), and variable bounds (lb ≤ x ≤ ub). The library automatically detects which solvers are available on your system and lists them in `qpsolvers.available_solvers`, letting you choose based on your problem structure and performance needs.
Use it for:
- Solve constrained least-squares problems by converting them to QP form with appropriate P and q matrices.
- Implement model predictive control or trajectory optimization in robotics by solving QPs at each time step.
- Benchmark multiple QP solvers on the same problem to find the fastest or most accurate for your use case.
- Add penalty terms (ridge regression, LASSO-like regularization) by incorporating them into the QP objective.
- Extract dual multipliers and sensitivity information for post-solution analysis or warm-starting.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a unified Python interface to solve convex quadratic programs using a choice of backend solvers, returning either the primal solution or primal and dual results.
Yes. The package is actively maintained, has low install friction, no known vulnerabilities, and solves a well-defined numerical problem with a clean API. The copyleft license requires attention if you plan to distribute derivative works, but the library itself and its optional backends cover both open-source and commercial use cases. Install it if you need to solve convex quadratic programs or want to experiment with multiple QP solvers.
Install
qpsolvers on PyPI
pip
pip install qpsolversuv
uv add qpsolverspoetry
poetry add qpsolversInstalling qpsolvers
Before you install
Low friction install with only numpy and scipy as runtime dependencies. Active maintenance with a recent release (26 days old) and steady repository activity.
License in practice
Licensed under LGPLv3 (copyleft). Derivative works must be distributed under compatible terms; proprietary use requires careful review or use of optional commercial solver backends.
Quickstart
import numpy as np
from qpsolvers import solve_qp
P = np.array([[4.0, 1.0], [1.0, 3.0]])
q = np.array([1.0, 1.0])
G = np.array([[1.0, 1.0], [1.0, -1.0]])
h = np.array([1.0, 1.0])
x = solve_qp(P, q, G, h, solver="proxqp")
print(x)
Requires Python 3.10 or later. Matrix P must be positive semi-definite (convex); some solvers require positive definite (strictly convex).
Verify before relying
- Whether all backend solvers are automatically installed or require separate installation steps
- Performance characteristics and solver selection guidance for specific problem classes
- Support for non-convex quadratic programs or workarounds
Package facts
| License | not declared (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — numpy, scipy |
| Maintenance | actively maintained — 26 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 831,731/month — #4,943 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: qpsolvers-4.13.0-py3-none-any.whl
Keywords: quadratic programming, solver, numerical optimization
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
daqpDAQP is a dual active-set solver for convex…
permissive · top 15,000 on PyPI
highspyHighspy is a Python wrapper around HiGHS, a…
permissive · top 5,000 on PyPI
osqpOSQP is a Python wrapper for the Operator…
permissive · top 5,000 on PyPI
proxsuiteProxSuite is a numerically robust quadratic…
permissive · top 15,000 on PyPI
quadprogSolves strictly convex quadratic programming…
copyleft · top 15,000 on PyPI
cvxoptcvxopt is a Python library for solving convex…
unclear · top 5,000 on PyPI
cvxpyCVXPY is a Python modeling language for…
permissive · top 5,000 on PyPI
cvxpy-basecvxpy-base provides compiled solver kernels for…
permissive · top 15,000 on PyPI
MosekMOSEK solves large-scale convex and…
unclear · top 15,000 on PyPI
ecosECOS is a Python wrapper for a numerical solver…
copyleft · top 5,000 on PyPI