Installation
mlbundle requires Python 3.14 or newer. Its only core dependency is Pydantic v2; every model library is an optional extra that is imported lazily, only when a bundle needs it.
These pages document mlbundle 0.3.1.
python -m pip install "mlbundle[sklearn,schema,lock]==0.3.1"Replace sklearn with the extra for your model library; the extras are listed
below.
From a local checkout
Section titled “From a local checkout”To work from source, or before 0.3.1 is available from your package index, install a checkout of the repository:
git clone https://github.com/UlloaSP/mlbundle.gitcd mlbundlepython -m pip install ".[sklearn,schema,lock]"Inside a uv project, add the checkout as a path dependency instead (adjust the path to where you cloned it):
uv add ../mlbundle --extra sklearn --extra schema --extra lockChoose the extras
Section titled “Choose the extras”| Extra | Installs | Needed for |
|---|---|---|
sklearn |
scikit-learn>=1.6, skops>=0.16.0 |
Exporting and loading scikit-learn models and pipeline prefixes. |
xgboost |
xgboost>=3.4.1, scikit-learn>=1.2 |
XGBClassifier and XGBRegressor. |
catboost |
catboost>=1.2.10 |
CatBoost classifiers and regressors. CatBoost brings matplotlib and plotly. |
onnx |
onnx>=1.23.0, onnxruntime>=1.30.0 |
Existing ONNX files. |
schema |
mlschema>=0.3.0,<0.4 on Python 3.14 only |
Every export. Also installs pandas. |
lock |
uv>=0.13.5 |
Every export that generates its runtime lock; not needed with environment_lock=. |
all |
All of the above | Development and mixed workloads. |
Pick by what each machine does:
- Training machine: the model extra plus
schemaandlock, for examplemlbundle[xgboost,schema,lock]. Export always infers a schema, even without training data, and resolvespylock.tomlthrough your package index. - Serving or verifying machine: only the matching model extra, for example
mlbundle[xgboost]. Loading validates the schema without pandas or mlschema. A runtime that serves bundles installs each bundle’spylock.tomlplus mlbundle at itswriter_versioninstead. - Metadata only: no extra.
inspectandmlbundle inspectnever import a model library.
Composite pipelines need both parts: [sklearn,xgboost] or [sklearn,catboost].
Verify the installation
Section titled “Verify the installation”from importlib.metadata import version
import mlbundle
print(version("mlbundle")) # 0.3.1print(mlbundle.FORMAT_NAME, mlbundle.FORMAT_VERSION) # mlbundle 1The console script is installed with the package:
mlbundle --helpTroubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Resolution |
|---|---|---|
MissingOptionalDependencyError naming schema |
Export runs without pandas or mlschema. | Install mlbundle[schema] on Python 3.14. |
MissingOptionalDependencyError naming lock |
Export cannot find uv to generate the lock. | Install mlbundle[lock], or pass environment_lock=. |
LockGenerationError |
uv found no single wheel for a Linux or Windows target, only an sdist, or could not reach the index. | Install versions with wheels for every target, check index access, or pass a lock generated elsewhere. |
InvalidEnvironmentLockError on export |
A supplied lock disagrees with the installed versions or Python. | Use a lock generated from this environment. |
MissingOptionalDependencyError naming a library |
Load or verify needs the model’s extra. |
Install the extra named in the message. |
mlbundle: missing optional dependency; install mlbundle[xgboost]. |
Same, from the CLI. | Install that extra; inspect works without it. |
EnvironmentMismatchError on load |
A skops load failed and the bundle locks a different scikit-learn version. | Install the bundle’s pylock.toml. |
No matching distribution found |
Python is older than 3.14. | Check python --version. |
