Install & Compatibility
Where this runs
tested against v2.3.2 · 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 18.2s · import 6.774s · 426MB
443MB installed
● package 443MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
dtreeviz
✓ from dtreeviz import dtreeviz
✗ import dtreeviz
The main function is inside the dtreeviz module. Using 'import dtreeviz' then calling dtreeviz.dtreeviz(...) is also valid but less common.
model
✓ from sklearn.tree import DecisionTreeRegressor
Train a simple decision tree regressor and visualize it with dtreeviz.
from sklearn.datasets import load_diabetes
from sklearn.tree import DecisionTreeRegressor
from dtreeviz import dtreeviz
diabetes = load_diabetes()
X = diabetes.data
y = diabetes.target
regr = DecisionTreeRegressor(max_depth=3)
regr.fit(X, y)
viz = dtreeviz(regr, X, y, target_name='diabetes', feature_names=diabetes.feature_names)
viz.view()
Debug
Known issues
breakingVersion 2.1.0 introduced a major refactoring. Functions like 'ctree_feature_space' changed signature; older code may break.fixUpdate function calls to match new signatures. Refer to changelog for specific changes.
affects: <2.1.0 → >=2.1.0
gotchaWhen using categorical features, ensure they are numeric-encoded. dtreeviz does not handle string categories natively in older versions; supported from 2.2.0 onward.fixUpgrade to >=2.2.0 or encode categories as integers before fitting.
affects: <2.2.0
Errors
Common errors & fixes
TypeError: dict() argument after ** must be a mapping, not float
Incompatibility with newer versions of numpy or other dependencies, fixed in 2.2.1.
fixUpgrade dtreeviz to >=2.2.1 or pin numpy to a compatible version.
KeyError when using decision_boundaries function
Bug in version 2.0.x, fixed in 2.1.0.
fixUpgrade dtreeviz to >=2.1.0.
Upgrade
Version history
2.3.2latest on PyPI · released Jan 2, 2026
Audit
Dependencies
No dependency data recorded yet.