linopy
Linear optimization with N-D labeled arrays in Python
Decision gist · record as of 2026-08-14
Yes. linopy is actively maintained, has low install friction, carries no known vulnerabilities, and offers a genuinely useful abstraction for optimization problems that naturally live in labeled arrays. Install it if you need to build optimization models with xarray-like data structures or if you want to avoid hand-coding matrix construction for multi-dimensional problems. The trade-off is that you must install a solver separately; linopy alone is only the modeling layer.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires an external solver (CBC, GLPK, HiGHS, SCIP, Gurobi, Xpress, Cplex, MOSEK, COPT, cuPDLPx, or Knitro) to be installed separately; linopy itself is only the modeling layer.
- Low install friction with a pure-Python wheel distribution.
- Active maintenance with a recent release (21 days old) and ongoing commits.
License · maintenance · safety
permissive license (permissive) — MIT license (permissive) means you can use, modify, and distribute linopy freely in commercial or private projects with minimal restrictions—only attribution and license inclusion required.
last release 2026-07-24 (21 days) · last repo commit 2026-08-13 · 253 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 134,199 downloads/mo, #11,485 on PyPI
Alternatives
Verify before relying
import linopy
m = linopy.Model()
apples = m.add_variables(lower=0, name="apples")
bananas = m.add_variables(lower=0, name="bananas")
m.add_constraints(3 * apples + 2 * bananas >= 8, name="daily_vitamins")
m.objective = apples + bananas
m.solve()- Performance comparison claims in the description refer to benchmarks not included in the fact sheet.
- Whether lazy operations with dask scale effectively for very large problems is not quantified.
- Solver selection and configuration details beyond the supported list are not documented in the excerpt.
What it is and what it does
linopy is a Python optimization modeling framework that lets you define linear, integer, mixed-integer, and quadratic programming problems using labeled n-dimensional arrays. It sits between data-handling libraries like xarray and external solvers, allowing you to express optimization constraints and objectives in a way that mirrors your data's natural structure—with coordinates like time, location, or consumer IDs—rather than flattening everything into matrices.
You define variables with bounds and coordinates, build constraints and objectives using arithmetic operations on those variables (with full broadcasting support), and then hand the model off to an external solver of your choice. linopy handles the translation to the solver's format and can import/export models via netCDF. It supports lazy evaluation with dask for large problems and is designed to make the optimization model transparent and easy to modify on the fly.
Use it for
- Energy system planning: optimize generation and storage across time and regions with coordinate-based constraints.
- Supply chain optimization: define inventory, production, and distribution variables indexed by product, location, and time period.
- Resource allocation: minimize cost or maximize utility subject to constraints on budget, capacity, or demand across labeled dimensions.
- Scheduling problems: model shift assignments or task scheduling using time and agent coordinates with linear constraints.
- Portfolio optimization: construct investment problems with asset and time-period coordinates and quadratic objectives.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
linopy is actively maintained, has low install friction, carries no known vulnerabilities, and offers a genuinely useful abstraction for optimization problems that naturally live in labeled arrays. Install it if you need to build optimization models with xarray-like data structures or if you want to avoid hand-coding matrix construction for multi-dimensional problems. The trade-off is that you must install a solver separately; linopy alone is only the modeling layer.
Install
linopy on PyPI
Before you install
Low install friction with a pure-Python wheel distribution. Active maintenance with a recent release (21 days old) and ongoing commits. Depends on well-established packages like numpy, scipy, xarray, and dask; no compiled system dependencies required by linopy itself.
Requires an external solver (CBC, GLPK, HiGHS, SCIP, Gurobi, Xpress, Cplex, MOSEK, COPT, cuPDLPx, or Knitro) to be installed separately; linopy itself is only the modeling layer.
License in practice
MIT license (permissive) means you can use, modify, and distribute linopy freely in commercial or private projects with minimal restrictions—only attribution and license inclusion required.
Quickstart
import linopy
m = linopy.Model()
apples = m.add_variables(lower=0, name="apples")
bananas = m.add_variables(lower=0, name="bananas")
m.add_constraints(3 * apples + 2 * bananas >= 8, name="daily_vitamins")
m.objective = apples + bananas
m.solve()
Verify before relying
- Performance comparison claims in the description refer to benchmarks not included in the fact sheet.
- Whether lazy operations with dask scale effectively for very large problems is not quantified.
- Solver selection and configuration details beyond the supported list are not documented in the excerpt.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 11 packagesnumpyscipybottlenecktoolznumexprxarraydaskpolarstqdmdeprecationpackaging |
| Maintenance | Actively maintained 21 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 134,199 / month, #11,485 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaEnvironment :: ConsoleIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Typing :: Typed |
Evidence: linopy-0.9.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “optimization with xarray”
- linopylinopy builds linear, integer, and quadratic optimization models…
- pystac-ext-xarray-assetsExtends PySTAC to support the Xarray Assets Extension specification,…
- xprojXProj is an Xarray extension that provides tools for managing…
Give your agent the search over MCP, or paste the wish link into any chat.
More Mathematics packages
NetworkX provides data structures and algorithms for creating, analyzing, and manipulating graphs and networks, supporting everything from simple undirected graphs to complex directed and weighted networks.
kiwisolver is a Python binding to a fast C++ implementation of the Cassowary constraint solver, enabling you to solve systems of linear constraints and inequalities.
Install it if you need to solve constraint systems; skip it if you only need simple linear algebra.
SymPy is a Python library for symbolic mathematics, performing algebraic manipulation, calculus, equation solving, and mathematical expression simplification without numerical approximation.
ContourPy calculates contours of 2D quadrilateral grids using C++11 algorithms wrapped in Python, offering serial and multithreaded implementations without requiring Matplotlib as a dependency.
PyTorch provides GPU-accelerated tensor computation and automatic differentiation for building and training deep neural networks in Python.
onnxruntime loads and executes Open Neural Network Exchange (ONNX) models with a focus on inference performance across CPUs and accelerators.
Install it if you have ONNX models to run in production or development.
See also mip · PuLP · xarray-einstats · xarray · optlang · cvxpy · amplpy · cobra · cvxopt · xpress