MLflow mlflow.exceptions.MlflowException: Experiment '...' not found

The specified experiment ID or name does not exist in the MLflow tracking server.

Understanding MLflow and Its Purpose

MLflow is an open-source platform designed to manage the machine learning lifecycle, including experimentation, reproducibility, and deployment. It provides a suite of tools to help data scientists and ML engineers track experiments, package code into reproducible runs, and share and deploy models. The core components of MLflow include Tracking, Projects, Models, and the Model Registry, each serving a specific purpose in the ML workflow.

Identifying the Symptom: Experiment Not Found

One common issue users encounter when working with MLflow is the error message: mlflow.exceptions.MlflowException: Experiment '...' not found. This error typically occurs when attempting to log metrics, parameters, or artifacts to an experiment that MLflow cannot locate in the tracking server.

Explaining the Issue: Why the Experiment is Not Found

This error arises when the specified experiment ID or name does not exist in the MLflow tracking server. It could be due to a typo in the experiment name, an incorrect experiment ID, or the experiment not being created prior to logging data. MLflow requires that experiments be explicitly created and referenced correctly to track runs successfully.

Common Scenarios Leading to This Error

  • Attempting to log data to a non-existent experiment.
  • Using an incorrect experiment ID or name.
  • Experiment deletion or misconfiguration in the tracking server.

Steps to Fix the Issue

To resolve this error, follow these steps to ensure that the experiment exists and is correctly referenced:

Step 1: Verify Experiment Existence

First, confirm that the experiment exists in your MLflow tracking server. You can list all experiments using the following command:

mlflow experiments list

This command will display all available experiments along with their IDs and names. Ensure that the experiment you intend to use is listed.

Step 2: Create the Experiment if Necessary

If the experiment does not exist, you can create it using the following command:

mlflow experiments create --experiment-name "your_experiment_name"

Replace "your_experiment_name" with the desired name for your experiment.

Step 3: Correctly Reference the Experiment

When logging data, ensure you reference the experiment by its correct ID or name. For example, in your Python script, you can set the experiment using:

mlflow.set_experiment("your_experiment_name")

Ensure that the name matches exactly with the one listed in your tracking server.

Additional Resources

For more detailed information on managing experiments in MLflow, refer to the official MLflow Tracking Documentation. Additionally, the MLflow CLI Documentation provides further insights into command-line operations for managing experiments.

Master

MLflow

in Minutes — Grab the Ultimate Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Real-world configs/examples
Handy troubleshooting shortcuts
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

MLflow

Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid