Registry / ai-ml / xpress

xpress

JSON →
library9.9.0pypypi✓ verified 86d ago

The FICO Xpress Optimizer Python interface (xpress) enables users to formulate, manage, and solve a comprehensive range of mathematical optimization problems including Linear Programming (LP), Quadratic Programming (QP), Second-Order Conic Programming (SOCP), and their mixed-integer counterparts (MILP, MIQP, MIQCQP, MISOCP), along with general nonlinear and mixed-integer nonlinear problems. It offers seamless integration with numerical libraries like NumPy and supports advanced features such as callbacks for solver control. The library is currently at version 9.8.1, with frequent updates including patches and minor versions released multiple times a year.

pip install xpress
INSTALL
IMPORT
SIG · XPRESS
X
xpress
ai-mlpythonv9.9.0
Install
5.2s avg
Import
292ms
Disk
231MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v9.9.0 · 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
musl
py 3.103.920 runs
build_error
glibc
py 3.103.920 runs
installs and imports cleanly · install 5.2s · import 0.292s · 232MB
231MB installed
● package 231MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

xpress
import xpress as xp
Aliasing as 'xp' is a widely adopted convention for brevity and readability.

This quickstart defines and solves a simple Linear Programming (LP) problem using the FICO Xpress Python interface. It initializes a problem, adds variables and constraints, sets an objective, and then optimizes the problem, printing the solution if optimal.

import xpress as xp p = xp.problem(name='my_first_lp') x1 = p.addVariable(name='x1', lb=0, ub=xp.infinity) x2 = p.addVariable(name='x2', lb=0, ub=xp.infinity) p.setObjective(3*x1 + 2*x2, sense=xp.minimize) p.addConstraint(4*x1 + 2*x2 >= 10, name='c1') p.addConstraint(x1 + x2 >= 3, name='c2') p.optimize() if p.getProbStatus() == xp.lp_optimal: print(f"Solution Status: Optimal") print(f"Objective Value: {p.getObjVal()}") print(f"x1 = {p.getSolution(x1)}") print(f"x2 = {p.getSolution(x2)}") else: print(f"Solution Status: {p.getProbStatusString()}")
Debug
Known issues
gotchaThe `xpress` library, while installable via pip, requires an underlying FICO Xpress license to solve problems. A 'Community License' is included, but it imposes strict limits on problem size (e.g., sum of variables and linear constraints <= 5000, nonlinear tokens <= 1000).
fix
For larger problems, a commercial FICO Xpress license is necessary. Ensure the `XPRESS` environment variable points to the directory containing your `xpauth.xpr` license file.
affects: All versions
gotchaGeneric `SystemError` or `RuntimeError` messages like `<built-in method [...] of xpress.problem object at [...]> returned NULL without setting an error` are frequently encountered in Jupyter notebooks or similar environments. These often obscure the actual, more descriptive error.
fix
Always check the console output or logs alongside the Python exception. The console typically contains the precise error message (e.g., 'Duplicate column names are not allowed').
affects: All versions (observed in 8.5.7 and later)
breakingModel properties on variable, constraint, and SOS objects (e.g., `var.lb`, `constraint.rhs`) are not accessible from within callbacks or while the problem is in a presolved state.
fix
Access these properties outside of callbacks or the presolve phase. If values are needed within a callback, store them in auxiliary data structures before the solve begins.
affects: 9.4.5 and potentially later (introduced prior to 9.4.5)
deprecatedSeveral older Xpress Python module versions (specifically 8.14.1, and 8.14.5 through 8.14.8) were removed from PyPI and Conda repositories on April 22, 2024.
fix
Users are advised to upgrade to Xpress 8.14.9 or a newer major release (e.g., 9.x). Archived versions may be available in the FICO Client area.
affects: 8.14.1, 8.14.5, 8.14.6, 8.14.7, 8.14.8
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'xpress'
The `xpress` Python package has not been installed in the current environment, or the environment is not correctly activated.
fix
Run `pip install xpress` to install the package. Ensure your Python environment is correctly set up and activated.
xpress.InterfaceError: Xpress licensing error 89: Your license only supports platform(s) win32, win_x86_64. Please contact support@fico.com to upgrade it.
This error indicates a mismatch between the platform for which the Xpress license (`xpauth.xpr`) was generated and the current operating system (e.g., using a Windows license on Linux), or the license file is invalid/missing.
fix
Verify that your license file is valid for your current platform and that the `XPRESS` environment variable is correctly set to the directory containing `xpauth.xpr`. Obtain a platform-appropriate license if necessary.
SystemError: <built-in method addVariable of xpress.problem object at 0x...> returned NULL without setting an error
This generic Python error typically masks a more specific underlying Xpress API error, such as attempting to add a variable with a duplicate name or providing invalid arguments. The true error message is often logged to the console.
fix
Check the terminal or IDE console output immediately preceding this error for a more descriptive message (e.g., '1030 Error: Duplicate column names are not allowed'). Correct the modeling mistake based on the detailed console error.
Upgrade
Version history
9.9.0latest on PyPI · released May 18, 2026
Audit
Dependencies
xpresslibsrequiredProvides underlying native Xpress Solver libraries, automatically installed by `pip install xpress`.
FICO Xpress LicenserequiredRequired for problem solving; a free Community License with size limits is included, or a full commercial license for larger problems.
Agent activity
44 hits · last 30 days
node
36
OpenAI (training)
1
Resources
xpress — pip install xpress · libregistry