Installation¶
From PyPI¶
pip install sgtlearn
Wheels are published for CPython 3.11–3.14 on Linux, macOS, and Windows (x86_64 + arm64); no compiler is needed for a binary install.
Requirements¶
Python ≥ 3.11
numpy≥ 1.20scikit-learn≥ 1.9joblib≥ 1.2matplotlib≥ 3.10.9,seaborn≥ 0.13.2,graphviz≥ 0.21 (plotting)
Developer setup (build from source)¶
Use a project-local virtual environment so Python, pytest, and scikit-learn stay isolated and reproducible.
uv (recommended)¶
uv provisions a hermetic CPython and resolves the dev extras in one step:
uv sync --all-extras
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip + venv (editable)¶
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -U pip
pip install -e ".[dev]"
The editable install builds the C++ extensions via scikit-build-core and
installs the sgtlearn package plus native modules into .venv.
Warning
Anaconda users: do not bootstrap the venv from an Anaconda Python.
Anaconda ships a libstdc++.so.6 that lags the symbol versions produced by
recent system compilers (gcc ≥ 13), so the install succeeds but
import sgtlearn fails with ImportError: GLIBCXX_3.4.NN not found.
Use a non-Anaconda Python — e.g. uv venv --python 3.12 .venv, pyenv,
or your distro’s python3.
Build workflow (scikit-build + CMake)¶
pip install . drives this build path:
pyproject.tomlselectsscikit_build_core.buildas the backend.CMake is configured from
cpp/CMakeLists.txt.Each file in
cpp/bindings/*.cppbecomes one pybind11 module target.After each module is built,
pybind11-stubgengenerates a matching.pyi.The
.pyiis installed alongside the module.so.