Registry / ai-ml / dtreeviz

dtreeviz

JSON →
library2.3.2pypypi✓ verified 89d ago

A Python 3 library for visualizing decision trees from scikit-learn, XGBoost, LightGBM, Spark, and TensorFlow. Version 2.3.2 supports AI chat integration for sklearn, categorical variables, and various tree model backends. Releases are frequent, approximately every few months.

pip install dtreeviz
INSTALL
IMPORT
SIG · DTREEVIZ
D
dtreeviz
ai-mlpythonv2.3.2
Install
18.2s avg
Import
6774ms
Disk
443MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
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
musl
py 3.10–3.95 runs
build_error
glibc
py 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.
fix
Update 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.
fix
Upgrade 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.
fix
Upgrade 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.
fix
Upgrade dtreeviz to >=2.1.0.
Upgrade
Version history
2.3.2latest on PyPI · released Jan 2, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
24 hits · last 30 days
node
22
Amazon
1
OpenAI (training)
1
Resources
dtreeviz — pip install dtreeviz · libregistry