MLflow Skinny

raw JSON →
3.10.1 verified Tue May 12 auth: no python install: verified quickstart: stale

MLflow Skinny is a lightweight Python package that provides core MLflow functionalities for experiment tracking and model management, omitting heavier dependencies like SQL storage, the MLflow UI, server, and extensive data science libraries. It serves as a foundation for users who need only the tracking and logging capabilities. MLflow is an open-source platform designed to streamline the entire machine learning lifecycle, supporting experiment tracking, reproducible code packaging, and model deployment. The current version is 3.10.1 and it requires Python >=3.10. The library maintains an active development status with frequent patch and minor releases, often on a monthly cadence.

pip install mlflow-skinny
error 'mlflow' is not recognized as an internal or external command, operable program or batch file
cause The `mlflow ui` command and related server functionalities are not included in the lightweight `mlflow-skinny` package.
fix
To use the MLflow UI, install the full mlflow package using pip install mlflow. If you intend to use mlflow-skinny, you must connect it to a separate, running MLflow tracking server that provides the UI.
error mlflow.tracking.registry.UnsupportedModelRegistryStoreURIException: Model registry functionality is unavailable; got unsupported URI 'sqlite:///mlflow.db'
cause By default, MLflow 3.x attempts to use a SQLite database for tracking, but `mlflow-skinny` excludes the necessary SQL dependencies (like SQLAlchemy and SQLite) for this backend.
fix
Explicitly set a file-based tracking URI (e.g., mlflow.set_tracking_uri('./mlruns')) or configure a remote HTTP/HTTPS tracking server URI (e.g., mlflow.set_tracking_uri('http://your-mlflow-server:5000')) before performing tracking operations.
error ModuleNotFoundError: No module named 'jinja2'
cause `mlflow-skinny` was missing `jinja2` as a direct dependency for certain model logging functionalities in some versions, even though it was required.
fix
Install the jinja2 package explicitly: pip install jinja2.
error ModuleNotFoundError: No module named 'mlflow'
cause The `mlflow` package, or specifically `mlflow-skinny`, is not installed in the active Python environment, or there are conflicting installations with other `mlflow`-related packages (`mlflow-tracing`, full `mlflow`).
fix
Ensure mlflow-skinny is correctly installed in your environment: pip install mlflow-skinny. If you intended the full mlflow package, use pip install mlflow. Consider using a clean virtual environment to avoid package conflicts.
breaking MLflow 3.x changed the default tracking URI from file-based (./mlruns) to SQLite (sqlite:///mlflow.db). `mlflow-skinny` does not include `sqlalchemy`, `alembic`, or `sqlparse` by default, leading to `UnsupportedModelRegistryStoreURIException` if a tracking URI is not explicitly set or these dependencies are not manually installed.
fix Explicitly set `mlflow.set_tracking_uri('file:///path/to/mlruns')` to use a file-based store without extra dependencies, or `pip install mlflow-skinny sqlalchemy alembic sqlparse` to enable SQLite support.
gotcha `mlflow-skinny` explicitly excludes the MLflow UI and server components. Running `mlflow ui` after installing only `mlflow-skinny` will result in an error like 'Unable to display MLflow UI - landing page (index.html) not found'.
fix To use the MLflow UI and server, you must install the full `mlflow` package (`pip install mlflow`) or manually build the UI assets if running from source (not recommended for general users).
gotcha Many MLflow features, particularly model flavors (e.g., `mlflow.sklearn`, `mlflow.tensorflow`), model serving (`mlflow models serve`), or advanced artifact storage, require additional dependencies not bundled with `mlflow-skinny`. Trying to use these features without the necessary extra packages will lead to `ImportError` or `ModuleNotFoundError`.
fix Install `mlflow-skinny` along with the specific extra dependencies needed for your use case (e.g., `pip install mlflow-skinny scikit-learn pandas` for `mlflow.sklearn` functionality, or `pip install mlflow-skinny flask` for serving).
breaking MLflow 3.x introduced several breaking changes. For example, the `run_uuid` attribute on `RunInfo` objects was removed and replaced by `run_id`. Some model flavors (e.g., `fastai`, `mleap`, `diviner`, `promptflow`) were deprecated or removed. The `log_model` API can now be called directly without `mlflow.start_run()` context.
fix Consult the MLflow 3.x Migration Guide for a comprehensive list of changes. Update code to use `run_id` instead of `run_uuid` and adjust model logging patterns as necessary.
gotcha MLflow's Git integration (`mlflow.utils.git_utils`) may fail to initialize if the Git executable is not found on the system's PATH, leading to warnings like 'Failed to import Git' and unavailability of Git SHA in runs.
fix Ensure that Git is installed on the system and its executable is included in the system's PATH environment variable. Alternatively, set the `GIT_PYTHON_GIT_EXECUTABLE` environment variable to the full path of the Git executable.
pip install mlflow-skinny scikit-learn numpy pandas
pip install mlflow-skinny sqlalchemy alembic sqlparse
python os / libc status wheel install import disk
3.10 alpine (musl) wheel - 5.16s 108.2M
3.10 alpine (musl) build_error - - - -
3.10 alpine (musl) wheel - 5.12s 135.9M
3.10 alpine (musl) - - 4.92s 105.5M
3.10 alpine (musl) - - - -
3.10 alpine (musl) - - 5.57s 133.1M
3.10 slim (glibc) wheel 11.5s 2.68s 109M
3.10 slim (glibc) wheel 23.5s 4.16s 432M
3.10 slim (glibc) wheel 13.6s 2.83s 134M
3.10 slim (glibc) - - 2.63s 106M
3.10 slim (glibc) - - 3.75s 429M
3.10 slim (glibc) - - 2.53s 132M
3.11 alpine (musl) wheel - 5.53s 122.0M
3.11 alpine (musl) build_error - - - -
3.11 alpine (musl) wheel - 5.68s 153.3M
3.11 alpine (musl) - - 6.18s 118.9M
3.11 alpine (musl) - - - -
3.11 alpine (musl) - - 6.98s 150.1M
3.11 slim (glibc) wheel 10.5s 3.80s 123M
3.11 slim (glibc) wheel 21.5s 5.33s 466M
3.11 slim (glibc) wheel 12.3s 3.67s 152M
3.11 slim (glibc) - - 3.47s 120M
3.11 slim (glibc) - - 4.97s 463M
3.11 slim (glibc) - - 3.48s 149M
3.12 alpine (musl) wheel - 5.33s 111.4M
3.12 alpine (musl) build_error - - - -
3.12 alpine (musl) wheel - 5.69s 142.0M
3.12 alpine (musl) - - 5.74s 108.3M
3.12 alpine (musl) - - - -
3.12 alpine (musl) - - 6.16s 138.9M
3.12 slim (glibc) wheel 9.3s 3.95s 112M
3.12 slim (glibc) wheel 21.6s 5.84s 444M
3.12 slim (glibc) wheel 10.8s 4.36s 141M
3.12 slim (glibc) - - 4.07s 109M
3.12 slim (glibc) - - 6.70s 441M
3.12 slim (glibc) - - 4.63s 138M
3.13 alpine (musl) wheel - 5.12s 111.0M
3.13 alpine (musl) build_error - - - -
3.13 alpine (musl) wheel - 5.03s 141.4M
3.13 alpine (musl) - - 5.31s 107.9M
3.13 alpine (musl) - - - -
3.13 alpine (musl) - - 5.17s 138.3M
3.13 slim (glibc) wheel 9.4s 3.61s 112M
3.13 slim (glibc) wheel 21.3s 5.23s 442M
3.13 slim (glibc) wheel 11.1s 3.57s 140M
3.13 slim (glibc) - - 3.92s 109M
3.13 slim (glibc) - - 5.61s 439M
3.13 slim (glibc) - - 4.41s 137M
3.9 alpine (musl) wheel - 3.06s 95.7M
3.9 alpine (musl) build_error - - - -
3.9 alpine (musl) wheel - 3.10s 122.3M
3.9 alpine (musl) - - 3.09s 94.5M
3.9 alpine (musl) - - - -
3.9 alpine (musl) - - 3.35s 121.1M
3.9 slim (glibc) wheel 11.7s 1.91s 96M
3.9 slim (glibc) wheel 25.6s 3.43s 435M
3.9 slim (glibc) wheel 14.9s 2.00s 122M
3.9 slim (glibc) - - 1.80s 95M
3.9 slim (glibc) - - 3.04s 433M
3.9 slim (glibc) - - 1.77s 120M

This quickstart demonstrates how to use `mlflow-skinny` for experiment tracking with scikit-learn's autologging feature. It logs a `RandomForestRegressor` model, its parameters, and metrics automatically. Note that for this example to run, `scikit-learn`, `numpy`, and `pandas` must be installed alongside `mlflow-skinny`. It explicitly sets a file-based tracking URI to avoid issues with MLflow 3.x's default SQLite backend, which `mlflow-skinny` doesn't support out-of-the-box.

import os
import mlflow
from sklearn.model_selection import train_test_split
from sklearn.datasets import load_diabetes
from sklearn.ensemble import RandomForestRegressor

# Ensure required dependencies are installed for this example (sklearn, numpy, pandas)
# pip install mlflow-skinny scikit-learn numpy pandas

# Set a tracking URI. With mlflow-skinny, a local file-based store (mlruns/) is often preferred
# or ensure `sqlalchemy` is installed for 'sqlite:///mlflow.db' default in MLflow 3.x.
# We use a local directory explicitly to avoid the default SQLite dependency issue.
mlflow.set_tracking_uri("file:///tmp/mlruns_quickstart")

# Enable MLflow's automatic experiment tracking for scikit-learn
# This will log parameters, metrics, and the model automatically
mlflow.sklearn.autolog()

# Load the training dataset
db = load_diabetes()
X_train, X_test, y_train, y_test = train_test_split(db.data, db.target)

# Train a RandomForestRegressor model
# MLflow triggers logging automatically upon model fitting due to autologging
with mlflow.start_run():
    rf = RandomForestRegressor(n_estimators=100, max_depth=6, max_features=3, random_state=42)
    rf.fit(X_train, y_train)

    # You can also manually log additional metrics or parameters if needed
    # mlflow.log_metric("example_custom_metric", 0.95)

print(f"MLflow Run completed. View runs at: {mlflow.get_tracking_uri()}")