Registry / azure / azureml-mlflow

azureml-mlflow

JSON →
library1.62.0.post5pypypi✓ verified 24d ago

The `azureml-mlflow` package provides integration code for connecting MLflow with Azure Machine Learning. It enables users to leverage MLflow's open-source capabilities for tracking machine learning experiments, logging metrics, parameters, and artifacts, and managing models directly within an Azure Machine Learning workspace. This facilitates centralized, secure, and scalable storage for MLflow-tracked assets, whether experiments run locally or on Azure compute. The library is actively maintained with regular updates.

pip install mlflow azureml-mlflow azure-ai-ml azure-identity
INSTALL
IMPORT
SIG · AZUREML-MLFLOW
A
azureml-mlflow
azurepythonv1.62.0.post5
Install
53.5s avg
Import
6742ms
Disk
1016MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.60.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 53.5s · import 6.742s · 953MB
1016MB installed
● package 1016MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mlflow
import mlflow
MLClient
from azure.ai.ml import MLClient
DefaultAzureCredential
from azure.identity import DefaultAzureCredential

This quickstart demonstrates how to configure MLflow to track experiments in an Azure Machine Learning workspace from a Python script. It sets the MLflow tracking URI to your Azure ML workspace and then logs a simple parameter and metric. Ensure you have `azure-ai-ml` and `azure-identity` installed and are authenticated to Azure (e.g., via `az login`).

import os import mlflow from azure.ai.ml import MLClient from azure.identity import DefaultAzureCredential # Replace with your Azure subscription, resource group, and workspace name # For local execution, ensure you are logged into Azure CLI or have appropriate env vars set subscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', 'YOUR_SUBSCRIPTION_ID') resource_group = os.environ.get('AZURE_RESOURCE_GROUP', 'YOUR_RESOURCE_GROUP') workspace_name = os.environ.get('AZURE_ML_WORKSPACE_NAME', 'YOUR_WORKSPACE_NAME') try: # Connect to Azure ML Workspace ml_client = MLClient( credential=DefaultAzureCredential(), subscription_id=subscription_id, resource_group_name=resource_group, workspace_name=workspace_name ) azureml_tracking_uri = ml_client.workspaces.get(ml_client.workspace_name).mlflow_tracking_uri mlflow.set_tracking_uri(azureml_tracking_uri) print(f"MLflow tracking URI set to: {mlflow.get_tracking_uri()}") # Start an MLflow run and log a metric with mlflow.start_run(run_name="quickstart_run") as run: mlflow.log_param("alpha", 0.5) mlflow.log_metric("accuracy", 0.95) print(f"Logged metric 'accuracy' in run: {run.info.run_id}") print("MLflow run completed. Check Azure ML Studio -> Jobs for details.") except Exception as e: print(f"An error occurred: {e}") print("Please ensure Azure credentials are configured (e.g., via Azure CLI 'az login')") print("and that the subscription, resource group, and workspace names are correct.")
Debug
Known issues
breakingAzure Machine Learning's MLflow integration is currently compatible with `mlflow<=2.16.x`. Versions `mlflow>=2.17` introduce breaking changes to artifact repository and `LoggedModels` API that are not yet supported by `azureml-mlflow`.
fix
Pin your MLflow version to `<=2.16.2` (e.g., `pip install 'mlflow<=2.16.2' azureml-mlflow`).
affects: azureml-mlflow < 1.62.0, mlflow >= 2.17.x
gotchaWhen combining training and inference in a single environment, `azureml-defaults` (often pulled for inference) requires `Flask>=3`, while `mlflow<2.8` requires `Flask<3`. This creates a dependency deadlock, making a single 'training + inference' environment unsupported with certain MLflow versions.
fix
Use separate environments for training (with compatible MLflow) and inference (with `azureml-defaults`). Do not force-downgrade Flask or remove `azureml-inference-server-http`.
affects: All versions combining `azureml-defaults` and `mlflow < 2.8` or `mlflow >= 2.8` (due to Azure ML tracking server API limitations).
breakingAs of `azureml-mlflow` version `1.62.0`, the `azure-common` package was removed as a dependency. Code relying on `azure-common` being transitively installed by `azureml-mlflow` will now fail with `ModuleNotFoundError`.
fix
Explicitly install `azure-common` in your environment if your code requires it (e.g., `pip install azure-common`).
affects: azureml-mlflow >= 1.62.0
gotchaWhen using MLflow with low-priority jobs in Azure ML that can be pre-empted and restarted, logging artifacts using `mlflow.start_run()` (without arguments, relying on Azure ML's auto-assigned run ID) can lead to failures. Azure ML's MLflow implementation does not allow overwriting existing artifacts for the same run ID upon restart.
fix
Consider implementing custom logic to handle restarts, such as checking for existing artifacts or using a new run ID on restart if artifact overwrite is critical.
affects: All versions when using low-priority jobs and default MLflow run behavior.
gotchaRemote MLflow tracking to Azure ML requires proper authentication. If running code outside an Azure ML compute instance (e.g., local machine), you must explicitly configure MLflow to use your Azure credentials, otherwise 403 (Not Authorized) errors will occur.
fix
Ensure `DefaultAzureCredential` is used with `MLClient` and that you are logged into Azure (e.g., `az login`) or relevant environment variables (`AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_TENANT_ID`) are set.
affects: All versions for remote tracking.
Upgrade
Version history
1.62.0.post5latest on PyPI · released Jul 1, 2026
Audit
Dependencies
mlflowrequiredCore MLflow functionality; tight version coupling.
azure-ai-mlrequiredRequired for programmatically interacting with Azure ML workspace and retrieving tracking URI (SDK v2).
azure-identityrequiredUsed for authenticating with Azure services.
azure-commonoptionalWas a dependency until 1.62.0; may need explicit install for older code.
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources