amplpy
Python API for AMPL
Decision gist · record as of 2026-08-14
Yes, if you need to solve optimization problems and want a mature, language-agnostic modeling layer. The active maintenance, broad Python version support, and permissive license make it a solid choice. Caveat: you must install a solver separately and obtain an AMPL license (free Community Edition available); this adds setup friction beyond a typical pip install.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a solver to be installed via `python -m amplpy.modules install <solver>` (e.g., highs, cbc, gurobi) and a valid AMPL license (free Community Edition available).
- Medium install friction: prebuilt wheels available for Python 3.8–3.14 across macOS, Linux, and Windows, but the package depends on ampltools and requires an AMPL solver installation (HiGHS, CBC, Gurobi, etc.) via a separate module installer.
- Repository is actively maintained with a recent release.
License · maintenance · safety
BSD-3 (permissive) — BSD-3 license is permissive; you can use amplpy in commercial and proprietary projects without copyleft obligations, though you must include the license notice.
last release 2026-07-21 (24 days) · last repo commit 2026-07-21 · 86 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 75,216 downloads/mo, #14,738 on PyPI
Alternatives
Verify before relying
pip install amplpy
python -m amplpy.modules install highs
from amplpy import AMPL
ampl = AMPL()
ampl.eval("var x >= 0; minimize cost: x;")
ampl.solve(solver="highs")- Whether ampltools is a compiled dependency that may require build tools on some platforms.
- Exact memory and CPU overhead when working with very large models or datasets.
- Whether the free AMPL Community Edition has model size or feature restrictions.
What it is and what it does
amplpy is a Python binding for AMPL, a domain-specific language for mathematical optimization. It lets you express optimization problems—linear, nonlinear, mixed-integer—using natural mathematical syntax within Python, then solve them with industry-standard solvers like Gurobi, HiGHS, or CBC. The library handles model generation and solver communication directly in AMPL's optimized C code, so you get performance without sacrificing readability.
You define models using AMPL's syntax (passed as strings), populate them with data from Python lists, pandas DataFrames, or numpy arrays, call solve(), and extract results back into Python objects. This workflow is especially useful for large-scale optimization where you want the stability and speed of compiled solvers but the flexibility of Python for data preprocessing and post-processing.
Use it for
- Portfolio optimization: define variance minimization with weight constraints, pass covariance matrices from pandas, solve with Gurobi.
- Supply chain planning: model production, inventory, and distribution constraints in AMPL, feed demand forecasts from Python, retrieve optimal schedules.
- Engineering design: set up nonlinear constraint systems, optimize over continuous or discrete variables, integrate results into a larger Python application.
- Research and prototyping: quickly iterate on optimization formulations without rewriting solver interfaces for each model variant.
- Production deployment: use the same AMPL model across Python, C++, or other languages by switching only the API layer.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to solve optimization problems and want a mature, language-agnostic modeling layer.
The active maintenance, broad Python version support, and permissive license make it a solid choice. Caveat: you must install a solver separately and obtain an AMPL license (free Community Edition available); this adds setup friction beyond a typical pip install.
Install
amplpy on PyPI
Before you install
Medium install friction: prebuilt wheels available for Python 3.8–3.14 across macOS, Linux, and Windows, but the package depends on ampltools and requires an AMPL solver installation (HiGHS, CBC, Gurobi, etc.) via a separate module installer. Repository is actively maintained with a recent release.
Requires a solver to be installed via `python -m amplpy.modules install <solver>` (e.g., highs, cbc, gurobi) and a valid AMPL license (free Community Edition available).
License in practice
BSD-3 license is permissive; you can use amplpy in commercial and proprietary projects without copyleft obligations, though you must include the license notice.
Quickstart
pip install amplpy
python -m amplpy.modules install highs
from amplpy import AMPL
ampl = AMPL()
ampl.eval("var x >= 0; minimize cost: x;")
ampl.solve(solver="highs")
Verify before relying
- Whether ampltools is a compiled dependency that may require build tools on some platforms.
- Exact memory and CPU overhead when working with very large models or datasets.
- Whether the free AMPL Community Edition has model size or feature restrictions.
Package facts
| License | BSD-3 permissive |
| Python support | Not specified |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packageampltools |
| Maintenance | Actively maintained 24 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 75,216 / month, #14,738 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: CProgramming Language :: PythonProgramming 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 :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Free Threading :: 2 - BetaProgramming Language :: Python :: Implementation :: CPythonTopic :: Scientific/EngineeringTopic :: Software Development |
Evidence: amplpy-0.18.0-cp310-cp310-macosx_10_9_universal2.whl; amplpy-0.18.0-cp310-cp310-macosx_10_9_x86_64.whl; amplpy-0.18.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; amplpy-0.18.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; amplpy-0.18.0-cp310-cp310-win_amd64.whl; amplpy-0.18.0-cp311-cp311-macosx_10_9_universal2.whl; amplpy-0.18.0-cp311-cp311-macosx_10_9_x86_64.whl; amplpy-0.18.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; amplpy-0.18.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; amplpy-0.18.0-cp311-cp311-win_amd64.whl; amplpy-0.18.0-cp312-cp312-macosx_10_13_universal2.whl; amplpy-0.18.0-cp312-cp312-macosx_10_13_x86_64.whl; amplpy-0.18.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; amplpy-0.18.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; amplpy-0.18.0-cp312-cp312-win_amd64.whl; amplpy-0.18.0-cp313-cp313-macosx_10_13_universal2.whl; amplpy-0.18.0-cp313-cp313-macosx_10_13_x86_64.whl; amplpy-0.18.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; amplpy-0.18.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; amplpy-0.18.0-cp313-cp313-win_amd64.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 › “AMPL Python interface”
- amplpyamplpy is a Python interface to AMPL, an algebraic modeling language…
- amplyAmply parses AMPL data syntax (sets and parameters) into Python data…
- python-interfaceDeclares interfaces and statically asserts that classes implement…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also aimmspy · amply · optlang · mip · PuLP · xpress · cylp · linopy · gurobipy · gekko