microsoft/qlib · error · NotImplementedError

Please implement the `list_experiments` method.

Error message

Please implement the `list_experiments` method.

What it means

ExpManager.list_experiments is an abstract method that must return a dict (name -> Experiment) of stored experiments; the base class body raises NotImplementedError. MLflowExpManager implements it by searching the tracking store. The error means an abstract or partial manager was asked to enumerate experiments.

Source

Thrown at qlib/workflow/expm.py:314

    def uri(self):
        """
        Get the default tracking URI or current URI.

        Returns
        -------
        The tracking URI string.
        """
        return self._active_exp_uri or self.default_uri

    def list_experiments(self):
        """
        List all the existing experiments.

        Returns
        -------
        A dictionary (name -> experiment) of experiments information that being stored.
        """
        raise NotImplementedError(f"Please implement the `list_experiments` method.")


class MLflowExpManager(ExpManager):
    """
    Use mlflow to implement ExpManager.
    """

    @property
    def client(self):
        # Please refer to `tests/dependency_tests/test_mlflow.py::MLflowTest::test_creating_client`
        # The test ensure the speed of create a new client
        return mlflow.tracking.MlflowClient(tracking_uri=self.uri)

    def _start_exp(
        self,
        *,
        experiment_id: Optional[Text] = None,
        experiment_name: Optional[Text] = None,

View on GitHub (pinned to 79633dd950)

Solutions

  1. Use the default MLflowExpManager (qlib.init defaults) so listing works.
  2. Implement list_experiments(self) in your subclass returning {name: Experiment}.
  3. Interim workaround: query the backend natively (e.g. MlflowClient.search_experiments).

Example fix

# before
ExpManager().list_experiments()  # NotImplementedError

# after
exps = R.list_experiments()  # {'alpha158': MLflowExperiment(...), ...}
Defensive patterns

Strategy: type-guard

Validate before calling

from qlib.workflow.expm import ExpManager
assert R.exp_manager.__class__.list_experiments is not ExpManager.list_experiments, 'listing unsupported'

Type guard

def manager_can_list(mgr) -> bool:
    from qlib.workflow.expm import ExpManager
    return mgr.__class__.list_experiments is not ExpManager.list_experiments

Prevention

When it happens

Trigger: R.list_experiments() when C['exp_manager']['class'] points to the base ExpManager or a custom subclass without the override; direct exp_manager.list_experiments() in tests.

Common situations: Custom tracking managers that support running experiments but not enumeration; onboarding scripts that list experiments before finishing a custom backend.

Related errors


AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15). Data as JSON: /api/errors/4fd45fefd5403447. Report an issue: GitHub.