quadprog
Quadratic Programming Solver
What it is and what it does
quadprog is a Python wrapper around a numerically stable dual algorithm for solving strictly convex quadratic programs. It takes a quadratic objective function and linear inequality constraints, then returns the optimal solution vector. The underlying implementation uses the Goldfarb/Idnani method, a well-established approach from mathematical programming literature.
The package depends only on numpy at runtime and provides pre-compiled wheels for modern Python versions across macOS, Linux, and Windows, making installation straightforward on common platforms. It is intended for education, financial modeling, insurance applications, and scientific research where constrained quadratic optimization is needed.
Use it for:
- Portfolio optimization in finance: minimize variance subject to budget and allocation constraints.
- Support vector machine training: solve the dual QP formulation for classification.
- Robotics and control: compute optimal control inputs under linear constraints.
- Machine learning: solve constrained least-squares problems in regression pipelines.
- Operations research: optimize resource allocation with linear inequality constraints.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Solves strictly convex quadratic programming problems using the Goldfarb/Idnani dual algorithm, minimizing a quadratic objective subject to linear inequality constraints.
Yes, if you need a lightweight, numerically stable QP solver for strictly convex problems and can accept GPLv2+ licensing. The pre-built wheels make installation frictionless on standard platforms. The dormant maintenance status (659 days since last release) is acceptable for a mature numerical library with no known vulnerabilities, but verify that the Goldfarb/Idnani algorithm meets your problem's scale and precision requirements before committing to production use.
Install
quadprog on PyPI
pip
pip install quadproguv
uv add quadprogpoetry
poetry add quadprogInstalling quadprog
Before you install
Medium install friction due to compiled C extension; pre-built wheels available for Python 3.9–3.13 on macOS (x86_64 and arm64), Linux (x86_64), and Windows (amd64). Package is dormant (last release 659 days ago) but repository remains active with no archived status.
License in practice
Licensed under GPLv2+, a copyleft license requiring derivative works to be distributed under the same terms. Acceptable for research, education, and open-source projects; may restrict use in proprietary closed-source applications.
Quickstart
import numpy as np
from quadprog import solve_qp
G = np.array([[1., 0.], [0., 1.]])
a = np.array([0., 0.])
C = np.array([[1., 1.], [-1., 1.]])
b = np.array([1., 1.])
result = solve_qp(G, a, C.T, b)
Requires a C compiler if installing from source distribution (sdist); pre-built wheels eliminate this requirement on supported platforms.
Verify before relying
- Whether the package handles numerical stability edge cases beyond the Goldfarb/Idnani algorithm's guarantees.
- Performance characteristics and scalability for large-scale problems (matrix dimensions, constraint count).
- Active maintenance roadmap or community support channels given dormant release status.
Package facts
| License | GPLv2+ (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | dormant — 659 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 592,741/month — #5,851 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: quadprog-0.1.13-cp310-cp310-macosx_10_9_x86_64.whl; quadprog-0.1.13-cp310-cp310-macosx_11_0_arm64.whl; quadprog-0.1.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; quadprog-0.1.13-cp310-cp310-win_amd64.whl; quadprog-0.1.13-cp311-cp311-macosx_10_9_x86_64.whl; quadprog-0.1.13-cp311-cp311-macosx_11_0_arm64.whl; quadprog-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; quadprog-0.1.13-cp311-cp311-win_amd64.whl; quadprog-0.1.13-cp312-cp312-macosx_10_13_x86_64.whl; quadprog-0.1.13-cp312-cp312-macosx_11_0_arm64.whl; quadprog-0.1.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; quadprog-0.1.13-cp312-cp312-win_amd64.whl; quadprog-0.1.13-cp313-cp313-macosx_10_13_x86_64.whl; quadprog-0.1.13-cp313-cp313-macosx_11_0_arm64.whl; quadprog-0.1.13-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; quadprog-0.1.13-cp313-cp313-win_amd64.whl; quadprog-0.1.13-cp39-cp39-macosx_10_9_x86_64.whl; quadprog-0.1.13-cp39-cp39-macosx_11_0_arm64.whl; quadprog-0.1.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; quadprog-0.1.13-cp39-cp39-win_amd64.whl
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
qpsolversProvides a unified Python interface to solve…
copyleft · top 5,000 on PyPI
osqpOSQP is a Python wrapper for the Operator…
permissive · top 5,000 on PyPI
daqpDAQP is a dual active-set solver for convex…
permissive · top 15,000 on PyPI
cvxoptcvxopt is a Python library for solving convex…
unclear · top 5,000 on PyPI
proxsuiteProxSuite is a numerically robust quadratic…
permissive · top 15,000 on PyPI
highspyHighspy is a Python wrapper around HiGHS, a…
permissive · top 5,000 on PyPI
directsearchSolves unconstrained and linearly constrained…
copyleft · top 15,000 on PyPI
MosekMOSEK solves large-scale convex and…
unclear · top 15,000 on PyPI
dwave-samplersProvides a collection of classical and hybrid…
permissive · top 15,000 on PyPI