How does Databricks Model Serving determine which Python packages to install for a deployed MLflow model?
Select an answer to reveal the explanation.
Short Explanation and Infographic
The conda.yaml or pip requirements file that gets logged with your model is the bill of materials for serving — Databricks reads it and rebuilds the exact same environment automatically.
Full explanation below image
Full Explanation
When a model is logged with mlflow.sklearn.log_model() or any framework-specific log_model(), MLflow automatically captures the Python environment: conda.yaml — captures conda channels and conda/pip dependencies at their exact versions. requirements.txt — captures pip dependencies. Both are stored as artifacts alongside the model. When the model is deployed to Databricks Model Serving: 1) The serving infrastructure reads the model's conda.yaml or requirements.txt. 2) Creates an isolated Python environment with those exact package versions. 3) Loads the model in that isolated environment. This ensures: the serving environment matches the training environment exactly (no version mismatches). Different endpoints can use different Python/library versions. Manual package specification is not required. The environment is per-model-version, not shared globally. mlflow.autolog() and mlflow.log_model() can use mlflow.models.infer_pip_requirements() to capture the full dependency set.