islpy

raw JSON →
2026.1 verified Mon Apr 27 auth: no python

Python wrapper around the Integer Set Library (isl), providing operations on integer sets, relations, and affine constraints. Current version 2026.1, released on a rolling basis with no fixed cadence.

pip install islpy
error ModuleNotFoundError: No module named 'islpy'
cause islpy not installed in the current Python environment.
fix
Run: pip install islpy
error ValueError: could not create isl_basic_set: invalid input
cause The string representation for a set or relation is malformed.
fix
Ensure the string follows isl syntax. For example: '{ [x] : x >= 0 }' or '[n] -> { [x] : x <= n }'.
breaking Python 3.10 minimum required; islpy dropped support for Python <3.10 in version 2024.x. Attempting to install on older Python will fail.
fix Upgrade to Python 3.10 or later.
gotcha String-based set representation uses isl's syntax, which can be confusing. Misplacing brackets or missing dimensions leads to errors.
fix Use islpy parsing helpers like isl.BasicSet.read_from_str or carefully double-check syntax.

Basic usage showing creation of integer sets and intersection.

import islpy as isl

# Create a basic set: all integer pairs (x, y) with x + y <= 5
s1 = isl.BasicSet('[n] -> { [x, y] : x + y <= n }')
print(s1)

# Create a second set
s2 = isl.BasicSet('[n] -> { [x, y] : x >= 0 and y >= 0 }')

# Intersection
intersection = s1.intersect(s2)
print(intersection)

# Check if non-empty
print(f"Is empty? {intersection.is_empty()}")