Install & Compatibility
Where this runs
tested against v2.4.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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.190s · 19.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.8s · import 0.168s · 20MB
18MB installed
● package 18MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Behaviour
✓ from py_trees.behaviour import Behaviour
✗ from py_trees import Behaviour
Behaviour is in its own module, not top-level
Sequence
✓ from py_trees.composites import Sequence
✗ from py_trees import Sequence
Composites are in py_trees.composites
Selector
✓ from py_trees.composites import Selector
✗ from py_trees import Selector
Composites are in py_trees.composites
Parallel
✓ from py_trees.composites import Parallel
✗ from py_trees import Parallel
Composites are in py_trees.composites
Running
✓ from py_trees.common import Running
✗ from py_trees import Running
Status constants are in py_trees.common
create_tree
✓ from py_trees.console import create_tree
✗ from py_trees import create_tree
Console utilities are in py_trees.console
Creates a simple sequence with two behaviours and ticks it.
import py_trees
# Create a simple sequence tree
root = py_trees.composites.Sequence(name="Root", memory=True)
move = py_trees.behaviours.SuccessEveryN(name="Move", n=5)
wait = py_trees.behaviours.Running(name="Wait")
root.add_children([move, wait])
# Create the tree
py_trees.trees.BehaviourTree(root)
# Tick the tree
for i in range(3):
root.tick_once()
print(f"Tick {i}: {root.status}")
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'py_trees'
The package is installed with a hyphen: py-trees, not py_trees.
AttributeError: module 'py_trees' has no attribute 'Behaviour'
Importing from the top-level instead of submodules.
fixfrom py_trees.behaviour import Behaviour
ValueError: The behaviour tree has not been initialised. Have you remembered to add the tree root to a BehaviourTree?
You created a tree but forgot to wrap it in py_trees.trees.BehaviourTree(root).
fixtree = py_trees.trees.BehaviourTree(root)
Upgrade
Version history
2.4.0latest on PyPI · released Nov 13, 2025
Audit
Dependencies
No dependency data recorded yet.