Errors when accessing MLflow artifacts without using the MLflow client

Resolve errors when attempting to access MLflow artifacts without using the MLflow client

Written by Adam Pavlacka

Last published at: May 16th, 2022

MLflow experiment permissions (AWS | Azure) are now enforced on artifacts in MLflow Tracking, enabling you to easily control access to your datasets, models, and other files.

Invalid mount exception

Problem

When trying to access an MLflow run artifact using Databricks File System (DBFS) commands, such as dbutils.fs, you get the following error:

com.databricks.backend.daemon.data.common.InvalidMountException: Error while using path /databricks/mlflow-tracking/<experiment-id>/<run-id>/artifacts for resolving path &#39;/<experiment-id>/<run-id>/artifacts&#39; within mount at &#39;/databricks/mlflow-tracking&#39;.

Cause

With the extension of MLflow experiment permissions to artifacts, DBFS access APIs for run artifacts stored in dbfs:/databricks/mlflow-tracking/ are no longer supported.

Solution

Upgrade to MLflow client version 1.9.1 or above to download, list, or upload artifacts stored in dbfs:/databricks/mlflow-tracking/.

%sh

pip install --upgrade mlflow

FileNotFoundError

Problem

When trying to access an MLflow run artifact using %sh/os.listdir(), you get the following error:

FileNotFoundError: [Errno 2] No such file or directory: '/databricks/mlflow-tracking/'

Cause

With the extension of MLflow experiment permissions to artifacts, run artifacts stored in dbfs:/databricks/mlflow-tracking/ can only be accessed using MLflow client version 1.9.1 or above.

Solution

Upgrade to MLflow client version 1.9.1 or above to download, list, or upload artifacts stored in dbfs:/databricks/mlflow-tracking/.

%sh

pip install --upgrade mlflow