gurobipy
Python interface to Gurobi
What it is and what it does
gurobipy is the official Python binding for Gurobi, a commercial optimization solver. It allows you to build optimization models in Python by defining variables, objective functions, and constraints, then solve them using Gurobi's underlying engine. The package supports mixed-integer linear programming (MIP), linear programming (LP), and quadratic optimization.
The package comes with a trial license that works out of the box but is limited to small problems. For production use or larger models, you need an academic license (free for students and staff at accredited institutions) or a commercial license. Installation is straightforward across modern Python versions and major platforms, but the licensing model means you cannot use it in production without obtaining the appropriate license.
Use it for:
- Solve supply chain and logistics optimization problems with integer constraints and large-scale linear models.
- Formulate and solve financial portfolio optimization, asset allocation, and risk management models.
- Tackle engineering design problems involving resource allocation, scheduling, and capacity planning.
- Prototype optimization algorithms in research or academic settings using the free academic license.
- Build production optimization applications with a commercial license for manufacturing or operations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
gurobipy is a Python interface to the Gurobi Optimizer for solving mixed-integer linear and quadratic optimization problems. It lets you formulate and solve optimization models directly from Python.
Yes, if you have a valid license or qualify for an academic license and need to solve mixed-integer or quadratic optimization problems. The trial license is useful for prototyping but not for production. If you need an open-source solver without licensing restrictions, consider alternatives; if you need industrial-grade performance, this is a leading choice.
Install
gurobipy on PyPI
pip
pip install gurobipyuv
uv add gurobipypoetry
poetry add gurobipyInstalling gurobipy
Before you install
Medium install friction: the package provides pre-built wheels for multiple Python versions (3.10–3.14) and platforms (macOS, Linux x86_64, Linux aarch64, Windows), but requires a valid license to function beyond trial evaluation.
License in practice
Licensed under a proprietary Evaluation License restricting use to non-production environments and limited problem sizes. Academic users and staff qualify for free full licenses; commercial users must request evaluation or purchase separately. The license is not open source and imposes strict usage restrictions.
Quickstart
import gurobipy as gp
m = gp.Model()
x = m.addVar(vtype='B', name='x')
y = m.addVar(vtype='B', name='y')
m.setObjective(x + y, gp.GRB.MAXIMIZE)
m.addConstr(x + y <= 1)
m.optimize()
print(f"Optimal value: {m.objVal}")
Requires a valid license (trial, academic, or commercial). The trial license bundled with pip install has size constraints on solvable problems.
Verify before relying
- Specific size limits (variable/constraint counts) imposed by the trial license
- Performance characteristics and solver speed relative to open-source alternatives
- Whether academic license activation requires manual registration or is automatic
Package facts
| License | Proprietary (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 101 days since the last release |
| First released | |
| Downloads | 1,363,368/month — #4,000 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gurobipy-13.0.2-cp310-cp310-macosx_10_9_universal2.whl; gurobipy-13.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; gurobipy-13.0.2-cp310-cp310-manylinux_2_26_aarch64.whl; gurobipy-13.0.2-cp310-cp310-win_amd64.whl; gurobipy-13.0.2-cp311-cp311-macosx_10_9_universal2.whl; gurobipy-13.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; gurobipy-13.0.2-cp311-cp311-manylinux_2_26_aarch64.whl; gurobipy-13.0.2-cp311-cp311-win_amd64.whl; gurobipy-13.0.2-cp312-cp312-macosx_10_13_universal2.whl; gurobipy-13.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; gurobipy-13.0.2-cp312-cp312-manylinux_2_26_aarch64.whl; gurobipy-13.0.2-cp312-cp312-win_amd64.whl; gurobipy-13.0.2-cp313-cp313-macosx_10_13_universal2.whl; gurobipy-13.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; gurobipy-13.0.2-cp313-cp313-manylinux_2_26_aarch64.whl; gurobipy-13.0.2-cp313-cp313-win_amd64.whl; gurobipy-13.0.2-cp314-cp314-macosx_10_15_universal2.whl; gurobipy-13.0.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; gurobipy-13.0.2-cp314-cp314-manylinux_2_26_aarch64.whl; gurobipy-13.0.2-cp314-cp314t-macosx_10_15_universal2.whl
Keywords: optimization, mip, lp
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
mipPython MIP models and solves mixed-integer…
copyleft · top 15,000 on PyPI
cplexProvides a Python interface to IBM CPLEX's…
unclear · top 15,000 on PyPI
aimmspyaimmspy provides Python bindings to run AIMMS…
permissive · top 15,000 on PyPI
amplpyamplpy is a Python interface to AMPL, an…
permissive · top 15,000 on PyPI
pyomoPyomo is a Python framework for formulating and…
permissive · top 5,000 on PyPI
PuLPPuLP is a linear and mixed-integer programming…
permissive · top 5,000 on PyPI
optlangOptlang formulates and solves linear,…
permissive · top 15,000 on PyPI
xpressPython interface to the FICO Xpress Optimizer…
unclear · top 15,000 on PyPI
docplexModeling library for building and solving…
permissive · top 15,000 on PyPI
cvxoptcvxopt is a Python library for solving convex…
unclear · top 5,000 on PyPI