skillfed

qpsolvers

Quadratic programming solvers in Python with a unified API.

qpsolvers v4.13.0 831.7K downloads/30d#4,943 on PyPI756
Copyleft license Active released

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 qpsolvers

uv

uv add qpsolvers

poetry

poetry add qpsolvers

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)Operating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Scientific/Engineering :: Mathematics

Tags

quadratic programming solverconvex QP solvernumerical optimizationsolve_qp functionQP backend abstractionlinear constraints optimizationmatrix optimization
optimizationnumerical-computingsolver-abstraction

More Mathematics packages