Python linear programming libraries

Updated Nov 2026

Python linear programming libraries model optimization problems as a linear objective with linear constraints and solve them for the best values. A modeling library builds the problem and hands it to a separate solver engine. These libraries let developers plan schedules, routes, and production mixes within fixed limits.

Popularity

SciPy has the most monthly downloads in this comparison, at 392.1M, a count that covers all its scientific computing.

LibraryMonthly downloadsStarsLast releaseLicense
SciPy
392.1M
15.2KAug 2026BSD-3-Clause
OR-Tools
8.4M
14.4KJan 2026Apache-2.0
HiGHS
7.2M
1.9KNov 2026MIT
OSQP
6.6M
130Jun 2026Apache-2.0
PuLP
6.4M
2.5KOct 2026MIT
Clarabel
5.4M
629Jun 2025Apache-2.0
SCS
5.3M
48Nov 2026MIT
CVXPY
5.3M
6.4KSep 2026Apache-2.0
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Features compared

LibraryInteger variablesNative cone constraintsNamed algebraic models
SciPyBuilt-inUnsupportedUnsupported
OR-ToolsBuilt-inUnsupportedBuilt-in
HiGHSBuilt-inUnsupportedBuilt-in
OSQPUnsupportedUnsupportedUnsupported
PuLPBuilt-inUnsupportedBuilt-in
ClarabelUnsupportedBuilt-inUnsupported
SCSUnsupportedBuilt-inUnsupported
CVXPYBuilt-inBuilt-inBuilt-in
Built-inNot supported

Libraries and code examples

Provides fundamental algorithms for scientific computing.

Downloads / mo
392.1M
Stars
15.2K
Last release
1.18.1
License
BSD-3-Clause
$ pip install scipy
from scipy.optimize import linprog

result = linprog([-1.0], bounds=[(0.0, 1.0)], method='highs')
print(result.message)

SciPy examples

From open-source projects on GitHub

Builds and solves linear models through the MPSolver interface.

Downloads / mo
8.4M
Stars
14.4K
Last release
9.15.6755
License
Apache-2.0

Strengths

  • Builds linear models with GLOP. Use GLOP with numeric variables and linear constraints.
  • Accepts candidate solutions. Pass an assignment through SetHint before solving.

Limitations

  • Hints can be ignored. Solvers do not guarantee using a supplied hint.
  • Duals require continuous problems. Read constraint dual values only for continuous models.
$ pip install ortools
from ortools.linear_solver import pywraplp

solver = pywraplp.Solver.CreateSolver('GLOP')
x = solver.NumVar(0, 1, 'x')
solver.Maximize(x)
status = solver.Solve()
print(status)

OR-Tools examples

From open-source projects on GitHub

Exposes HiGHS model building and solver operations to Python.

Downloads / mo
7.2M
Stars
1.9K
Last release
1.16.0
License
MIT

Strengths

  • Builds models through Python expressions. Create variables and constraints with addVariable and addConstr.
  • Exposes constraint dual values. Read the dual value of a selected constraint after solving.

Limitations

  • HiPO needs an extra package. Install highspy-extras to use HiPO through Python.

Quickstart

From example-py.md
$ pip install highspy
import highspy

solver = highspy.Highs()
x = solver.addVariable(lb=0, ub=1, obj=-1)
solver.run()
print(solver.getModelStatus())

HiGHS examples

From open-source projects on GitHub

Solves quadratic programs with operator splitting.

Downloads / mo
6.6M
Stars
130
Last release
1.1.3
License
Apache-2.0

Quickstart

From python.html
$ pip install osqp
import numpy as np
from scipy import sparse
import osqp

solver = osqp.OSQP()
solver.setup(P=sparse.csc_matrix((1, 1)), q=np.array([-1.0]),
             A=sparse.csc_matrix([[1.0]]), l=np.array([0.0]), u=np.array([1.0]))
result = solver.solve(raise_error=False)
print(result.info.status)

OSQP examples

From open-source projects on GitHub

Models linear and mixed-integer problems for separate solver backends.

Downloads / mo
6.4M
Stars
2.5K
Last release
4.2.0
License
MIT

Strengths

  • Separates modeling from solver choice. Build a model and select an available solver backend.
  • Exports problems to JSON. Serialize the model with toJson for later loading.

Limitations

  • CBC needs a separate installation. Install the CBC extra or supply another solver before solving.
  • Variables now belong to problems. Create variables through prob.add_variable before adding expressions.

Quickstart

From README.rst
$ pip install pulp[cbc]
from pulp import LpProblem, LpMinimize

problem = LpProblem('first_model', LpMinimize)
x = problem.add_variable('x', lowBound=0, upBound=1)
problem += -x
stats = problem.solve()
print(stats.status_str)

PuLP examples

From open-source projects on GitHub
def __contains__(self, x: object) -> bool:
        try:
            import pulp

            return pulp.getSolver(x).available()
        except Exception:  # noqa: BLE001
            return False

Solves conic problems with an interior-point method.

Downloads / mo
5.4M
Stars
629
Last release
0.11.1
License
Apache-2.0

Quickstart

From README.md
$ pip install clarabel
import clarabel
import numpy as np
from scipy import sparse

solver = clarabel.DefaultSolver(
    sparse.csc_matrix((1, 1)), np.array([-1.0]),
    sparse.csc_matrix([[1.0], [-1.0]]), np.array([1.0, 0.0]),
    [clarabel.NonnegativeConeT(2)], clarabel.DefaultSettings())
solution = solver.solve()
print(solution.status)

Clarabel examples

From open-source projects on GitHub

Solves conic problems with a splitting method.

Downloads / mo
5.3M
Stars
48
Last release
3.3.2
License
MIT

Quickstart

From README.md
$ pip install scs
import numpy as np
from scipy import sparse
import scs

data = {'A': sparse.csc_matrix([[1.0], [-1.0]]),
        'b': np.array([1.0, 0.0]), 'c': np.array([-1.0])}
solver = scs.SCS(data, {'l': 2})
result = solver.solve()
print(result['info']['status'])

SCS examples

From open-source projects on GitHub

Models convex optimization problems in a domain-specific language.

Downloads / mo
5.3M
Stars
6.4K
Last release
1.9.3
License
Apache-2.0

Quickstart

From cvxpy.problems.html
$ pip install cvxpy
import cvxpy as cp

x = cp.Variable()
problem = cp.Problem(cp.Minimize(-x), [x >= 0, x <= 1])
problem.solve()
print(problem.status)

CVXPY examples

From open-source projects on GitHub

FAQ

PuLP suits linear and mixed-integer models that can run on several solvers. OR-Tools suits models built from named variables through its MPSolver interface. SciPy suits problems already expressed as arrays.

CVXPY is a modeling language for convex optimization problems. It checks a problem against disciplined convex programming rules and dispatches it to a compatible installed solver.

PuLP is a linear programming modeler that writes MPS or LP files and calls solvers such as GLPK, CBC, CPLEX, and Gurobi.

SciPy exposes linear and mixed-integer programming through functions that take the objective and constraints as arrays.

For coding agents

Found your linear programming library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official