Pyperplan

raw JSON →
2.1 verified Sat May 09 auth: no python maintenance

A lightweight STRIPS planner implemented in pure Python. No external solver required. Current version 2.1 (2022-01-17) with Python >=3.6 support. Maintenance-only status; last release 2022.

pip install pyperplan
error AttributeError: module 'pyperplan' has no attribute 'search_plan'
cause Incorrect import: importing the top-level module instead of the function.
fix
Use 'from pyperplan import search_plan'
error ModuleNotFoundError: No module named 'pyperplan'
cause The package is not installed.
fix
Run 'pip install pyperplan'
gotcha pyperplan only supports STRIPS (no ADL, no negative preconditions, no conditional effects). Using non-STRIPS PDDL will silently produce incorrect grounding.
fix Ensure your domain and problem files are STRIPS-only.
gotcha The package is no longer actively maintained. The last release (2.1) is from January 2022. Python versions above 3.10 may have compatibility issues with outdated dependencies.
fix Consider forking or switching to alternatives like Tarski or Pyperplan fork if updates are needed.

Load a PDDL domain and problem file, ground the task, and find a plan using the hmax heuristic.

from pyperplan import search_plan
from pyperplan.grounding import ground
from pyperplan.heuristics import hmax
from pyperplan.pddl import parse_domain, parse_problem

domain = parse_domain('domain.pddl')
problem = parse_problem('problem.pddl')
task = ground(domain, problem)
plan, _ = search_plan(task, hmax)
print('; '.join(plan))