Install & Compatibility
Where this runs
tested against v0.16.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.6s · import 0.120s · 30MB
29MB installed
● package 29MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AMPL
✓ from amplpy import AMPL
✗ import amplpy
amplpy.AMPL()
Namespace import unnecessary; direct import is standard
DataFrame
✓ from amplpy import DataFrame
✗ from pandas import DataFrame
AMPL DataFrame is separate from pandas DataFrame; using pandas will cause errors
Environment
✓ from amplpy import Environment
Create an AMPL instance, evaluate a simple model, solve it, and print the objective value.
from amplpy import AMPL, DataFrame
ampl = AMPL()
ampl.eval('var x; maximize obj: x; subject to c: x <= 1;')
ampl.solve()
print('Objective:', ampl.getValue('obj'))
amplpy --version
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'amplpy'
amplpy is not installed, or installed in a different Python environment.
fixRun `pip install amplpy` in the correct environment (e.g., virtualenv).
RuntimeError: AMPL executable not found. Please set the AMPL path
AMPL is not installed or not in PATH, and amplpy cannot locate the AMPL executable.
fixSet the AMPL path via environment variable `AMPLBIN` or pass `Environment(ampl_bin='/path/to/ampl')` to the `AMPL` constructor.
TypeError: No matching signature found
Using numpy or pandas data types that are not supported by AMPL's C++ interface; often due to using pandas DataFrames with non-string column names.
fixConvert column names to strings and ensure data types are basic (int, float, str).
Upgrade
Version history
0.16.1latest on PyPI · released May 26, 2026
Audit
Dependencies
numpyoptionalUsed for array data handling in data frames and entity values