{"id":657,"library":"mlflow","title":"MLflow","description":"MLflow is an open-source platform designed to manage the entire machine learning lifecycle, encompassing experiment tracking, reproducible projects, model management, and deployment. The current stable version is 3.10.1, with frequent updates including patch, minor, and major releases that introduce new features and breaking changes. [9, 16]","status":"active","version":"3.10.1","language":"python","source_language":"en","source_url":"https://github.com/mlflow/mlflow","tags":["machine learning","MLOps","experiment tracking","model registry","model deployment","LLMs"],"install":[{"cmd":"pip install mlflow","lang":"bash","label":"Install MLflow"}],"dependencies":[],"imports":[{"note":"Main MLflow module for tracking, models, projects.","symbol":"mlflow","correct":"import mlflow"},{"note":"For lower-level interaction with the MLflow Tracking Server. [21]","symbol":"MlflowClient","correct":"from mlflow.tracking import MlflowClient"},{"note":"Utility to infer model signatures automatically. [2]","symbol":"infer_signature","correct":"from mlflow.models import infer_signature"}],"quickstart":{"code":"import mlflow\nimport pandas as pd\nfrom sklearn import datasets\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.metrics import accuracy_score\nfrom mlflow.models import infer_signature\n\n# Set MLflow tracking URI (optional, defaults to local ./mlruns)\n# For a local server, run 'mlflow ui' in your terminal and point to http://127.0.0.1:5000\n# os.environ['MLFLOW_TRACKING_URI'] = os.environ.get('MLFLOW_TRACKING_URI', 'http://127.0.0.1:5000')\n\nmlflow.set_experiment(\"MLflow_Quickstart_Experiment\")\n\n# Load the Iris dataset\nX, y = datasets.load_iris(return_X_y=True)\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\n# Define model hyperparameters\nparams = {\"solver\": \"lbfgs\", \"max_iter\": 1000, \"multi_class\": \"auto\", \"random_state\": 8888}\n\nwith mlflow.start_run():\n    # Log hyperparameters\n    mlflow.log_params(params)\n\n    # Train the model\n    lr = LogisticRegression(**params)\n    lr.fit(X_train, y_train)\n\n    # Make predictions and calculate metrics\n    y_pred = lr.predict(X_test)\n    accuracy = accuracy_score(y_test, y_pred)\n    mlflow.log_metric(\"accuracy\", accuracy)\n\n    # Infer model signature\n    predictions = lr.predict(X_train) # Use training data for signature inference\n    signature = infer_signature(X_train, predictions)\n\n    # Log the model\n    mlflow.sklearn.log_model(\n        sk_model=lr,\n        artifact_path=\"logistic_regression_model\",\n        signature=signature,\n        registered_model_name=\"IrisLogisticRegression\"\n    )\n\n    print(f\"Logged model with accuracy: {accuracy}\")\n    print(f\"View runs in MLflow UI: run 'mlflow ui' in your terminal and navigate to http://127.0.0.1:5000\")","lang":"python","description":"This quickstart demonstrates how to log parameters, metrics, and a scikit-learn model using the MLflow fluent API. It sets up an experiment, trains a logistic regression model on the Iris dataset, logs its hyperparameters and accuracy, infers the model signature, and registers the model in the MLflow Model Registry. To view the results, start the MLflow UI by running `mlflow ui` in your terminal and navigating to `http://localhost:5000` (or `http://127.0.0.1:5000`). [2, 5, 22]"},"warnings":[{"fix":"Review the MLflow 3 Migration Guide. For Recipes, migrate to standard MLflow tracking/model registry or MLflow Projects. For unsupported flavors, use `mlflow.pyfunc` with a custom wrapper or `mlflow.onnx`/`mlflow.pytorch`. Use the new AI Gateway configuration format and `mlflow models serve` for deployments. [1]","message":"MLflow 3.x introduced significant breaking changes, including the complete removal of MLflow Recipes. Many model flavors (fastai, mleap, diviner) are no longer supported directly. The 'routes' and 'route_type' config keys for AI Gateway were removed. The deployment server and `start-server` CLI command have been removed, replaced by `mlflow models serve` or containerized deployments. [1, 3]","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Update code to use `run_id` instead of `run_uuid`. Remove reliance on the deprecated Git tags or implement custom tagging for similar information. [1]","message":"In MLflow 3.x, the `run_uuid` attribute on `RunInfo` objects has been removed and replaced by `run_id`. Additionally, several Git-related run tags (`mlflow.gitBranchName`, `mlflow.gitRepoURL`) were removed. [1]","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Navigate to the 'Logged Models' page in the MLflow UI to view model-specific information and artifacts. Update any automation or user guides that rely on the old UI structure. [1]","message":"The Artifacts tab in the MLflow UI for runs no longer displays model artifacts in MLflow 3.x. Model artifacts are now accessed through a dedicated 'Logged Models' page. [1]","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"For deprecated `artifact_path`, use `name`. For `code_path`, use the default code directory structure. For PyTorch `requirements_file`, use `pip_requirements` or `extra_pip_requirements`. For Transformers `inference_config`, set the configuration before logging the model. [1]","message":"Parameters like `artifact_path` are deprecated; use `name` instead. Additionally, parameters such as `example_no_conversion` and `code_path` have been removed from model logging/saving APIs. `requirements_file` for PyTorch flavor is removed, and `inference_config` from Transformers flavor is also removed. [1]","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Follow the official upgrade procedure carefully. Plan for downtime or implement a rolling upgrade strategy with a load balancer for high availability. Back up your database before any migration. [16]","message":"When upgrading a self-hosted MLflow server, it is crucial to stop the server, upgrade the package, run database migrations using `mlflow db upgrade <backend-store-url>`, and then restart the server. MLflow does not natively support live upgrades, and schema migrations can be slow and non-transactional. Always back up your database before migration. [16]","severity":"gotcha","affected_versions":"All versions"},{"fix":"Strive to keep your MLflow client SDK and server versions aligned. If using new client features, ensure your server is also updated to a compatible version. [16]","message":"MLflow clients and servers work best when they are on the same version. While a newer server is generally backward compatible with older clients for basic logging, using newer client features (e.g., MLflow Tracing) with an older server might lead to missing endpoints or unexpected behavior. [16]","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install necessary build tools and compilers (e.g., `build-base`, `gcc`, `g++`, `python3-dev`) in your Dockerfile or environment before attempting to install such packages. For Alpine, typically `apk add build-base gcc python3-dev` is required.","message":"Building native Python packages (e.g., scikit-learn, numpy, pandas, cryptography) in minimal environments like Alpine Linux often fails due to missing C/C++ compilers and development headers. These packages require tools like `gcc` and `g++` to compile their C/Fortran/C++ extensions during installation.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-05-12T17:26:01.078Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Install MLflow using pip or conda in your active environment: `pip install mlflow` or `conda install -c conda-forge mlflow`","cause":"The MLflow library is not installed in the current Python environment or the environment where the code is being executed. [3, 7, 17, 18, 25]","error":"ModuleNotFoundError: No module named 'mlflow'"},{"fix":"Explicitly import the specific flavor module, for example: `import mlflow.sklearn` or `from mlflow import sklearn`. Ensure the underlying machine learning library (e.g., scikit-learn) is also installed.","cause":"You are attempting to access an MLflow integration (e.g., 'sklearn', 'keras', 'pytorch') as a direct attribute of the top-level 'mlflow' module, but these integrations are typically imported as submodules or are not directly exposed this way. [14, 18, 30]","error":"AttributeError: module 'mlflow' has no attribute 'sklearn'"},{"fix":"Refer to the MLflow documentation for the specific function being used (e.g., `mlflow.log_param`, `mlflow.log_metric`) to verify the correct parameter names, expected data types, and valid value ranges.","cause":"An incorrect parameter name, an unsupported value, or a value of the wrong data type was provided to an MLflow logging or API function. [5]","error":"mlflow.exceptions.MlflowException: Invalid parameter"},{"fix":"Start a remote MLflow Tracking Server (e.g., `mlflow server --backend-store-uri sqlite:///mlflow.db --default-artifact-root ./mlruns`) and configure your client to use its HTTP(S) address by setting the `MLFLOW_TRACKING_URI` environment variable or calling `mlflow.set_tracking_uri('http://localhost:5000')`.","cause":"This error occurs when trying to serve an MLflow model, often with `mlflow models serve --enable-mlserver`, but the MLflow tracking URI is configured to a local `file://` path. Remote model serving requires artifacts to be accessible via an HTTP(S) MLflow Tracking Server. [15, 20]","error":"mlflow.exceptions.MlflowException: When an mlflow-artifacts URI was supplied, the tracking URI must be a valid http or https URI, but it was currently set to file:///..."},{"fix":"Verify that the specified path is correct, exists, and that the user running the MLflow process has appropriate read/write permissions. If using `mlflow server`, ensure `--backend-store-uri` and `--default-artifact-root` (or `--artifacts-destination`) are correctly configured and accessible.","cause":"MLflow cannot find a required file or directory for its tracking store (typically `mlruns`) or artifact storage, likely due to an incorrect path, insufficient permissions, or the directory not existing. [1, 9, 28, 35, 37, 38]","error":"OSError: No such file or directory: '/path/to/mlruns/...' "}],"ecosystem":"pypi","meta_description":null,"install_score":35,"install_tag":"stale","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"3.12.0","install_checks":{"last_tested":"2026-05-12","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":1,"wheel_type":null,"failure_reason":"build_error","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":38.4,"import_time_s":4.63,"mem_mb":76.1,"disk_size":"734M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":3.93,"mem_mb":75.6,"disk_size":"732M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":1,"wheel_type":null,"failure_reason":"build_error","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":37.1,"import_time_s":5.71,"mem_mb":83,"disk_size":"794M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":5.36,"mem_mb":82.6,"disk_size":"791M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":1,"wheel_type":null,"failure_reason":"build_error","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":34.5,"import_time_s":6.12,"mem_mb":81,"disk_size":"768M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":6.65,"mem_mb":80.6,"disk_size":"766M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":1,"wheel_type":null,"failure_reason":"build_error","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":37.4,"import_time_s":5.78,"mem_mb":84.5,"disk_size":"765M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":5.88,"mem_mb":81,"disk_size":"763M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":1,"wheel_type":null,"failure_reason":"build_error","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":37.6,"import_time_s":3.87,"mem_mb":66.4,"disk_size":"767M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":3.27,"mem_mb":66.4,"disk_size":"766M"}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":-1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":-1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":-1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":-1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":-1}]}}