skillfed

gurobipy

Python interface to Gurobi

gurobipy v13.0.2 1.4M downloads/30d#4,000 on PyPI
License unclear Proprietary Active released

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 gurobipy

uv

uv add gurobipy

poetry

poetry add gurobipy

Installing 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

Operating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPython

Tags

mixed-integer linear programming solvermathematical optimization libraryMIP solver pythonquadratic optimizationconstraint optimizationlinear programming pythonoptimization modeling
optimizationcommercial-solverlicensing-required

More Mathematics packages