Skip to main content

67 posts tagged with "uv"

uv, the Fast Python Package and Project Manager, Its Commands and pyproject.toml

View All Tags

How to Prepare an MLflow Model's Environment Before Serving It

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

Before mlflow models serve can start a model, it builds an environment with the model's Python version and packages. mlflow models prepare-env does that step on its own, ahead of time, so serve finds the environment ready. This guide prepares one and serves the model after it, with real output and times from MLflow 3.18.0 on a Mac.

Fixed: "MlflowException: Could not find the pyenv binary" When You Run mlflow models serve

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

I ran mlflow models serve the way MLflow's local deployment guide shows it, and it stopped before the server started, with mlflow.exceptions.MlflowException: Could not find the pyenv binary. Without --env-manager, the command builds the model's environment with virtualenv, which needs pyenv to install the model's Python version, and pyenv isn't installed on my Mac. --env-manager uv fixed it.

Fixed: "Detected one or more mismatches between the model's dependencies and the current Python environment" in MLflow

· 9 min read
Jagdish Kumawat
Founder @ Dewiride

I upgraded a project's packages and then scored some sessions with a model I had logged before the upgrade. MLflow printed WARNING mlflow.utils.requirements_utils: Detected one or more mismatches between the model's dependencies and the current Python environment, with five packages one release apart. MLflow had pinned the project's whole lockfile into the model when it logged it; running the model in its own environment, built from those pins, fixed it.

How to Log SHAP Explanations with mlflow.models.evaluate

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

Metrics say how well a model does; they don't say why. SHAP values explain each prediction column by column: how much each input pushed it up or down. mlflow.models.evaluate computes them and logs three plots by itself, as soon as the shap package is installed. This guide installs it, evaluates a diabetes model and reads the plots, with real output and UI from MLflow 3.18.0.

How to Make a Python Script Exit with an Error Code

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

A script that checks something, such as tests, data or a model's scores, should tell the shell whether the check passed, so that a CI job or another script can stop when it didn't. That's what an exit code is for: 0 for success, anything else for failure. This guide makes a script exit with 1 when a check fails, and reads the code back in bash, zsh and PowerShell, with real output from Python 3.15.2.

Fixed: "SHAP or matplotlib package is not installed, so model explainability insights will not be logged" in MLflow

· 8 min read
Jagdish Kumawat
Founder @ Dewiride

Every evaluation I ran with mlflow.models.evaluate printed WARNING mlflow.models.evaluation.evaluators.shap: SHAP or matplotlib package is not installed, so model explainability insights will not be logged. MLflow 3.18.0's default evaluator explains classifiers and regressors with SHAP, an optional package that mlflow doesn't install. There are two fixes, depending on whether you want the explanations: install shap, or turn explainability off.

How to Test an MLflow Model in a Fresh Environment with mlflow.models.predict

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

A model that predicts on your computer can still fail elsewhere: a package it needs may be missing from its recorded requirements, because your own environment happened to have it. mlflow.models.predict catches that before deployment: it builds a brand-new virtual environment from the model's own requirements and predicts in it. This guide runs it with uv, with real output from MLflow 3.18.0.

MLflow Tutorial for Machine Learning in Python — Part 1: Install MLflow and Track Your First Experiment

· 42 min read
Jagdish Kumawat
Founder @ Dewiride

Every time you train a model, you change something: the number of trees, a setting, the data. A week later nobody remembers which change gave the best result. MLflow remembers it for you. In this first part you install MLflow, start your own tracking server, and log your first machine learning experiment from Python.