microsoft/qlib · error · NotImplementedError
Please implement the `delete_exp` method.
Error message
Please implement the `delete_exp` method.
What it means
ExpManager.delete_exp is abstract: concrete managers delete the experiment identified by experiment_id or experiment_name. The base stub raises NotImplementedError, meaning no backend (normally MLflowExpManager, which calls client.delete_experiment) executed the deletion.
Source
Thrown at qlib/workflow/expm.py:280
Raises
------
ValueError
"""
raise NotImplementedError(f"Please implement the `_get_exp` method")
def delete_exp(self, experiment_id=None, experiment_name=None):
"""
Delete an experiment.
Parameters
----------
experiment_id : str
the experiment id.
experiment_name : str
the experiment name.
"""
raise NotImplementedError(f"Please implement the `delete_exp` method.")
@property
def default_uri(self):
"""
Get the default tracking URI from qlib.config.C
"""
if "kwargs" not in C.exp_manager or "uri" not in C.exp_manager["kwargs"]:
raise ValueError("The default URI is not set in qlib.config.C")
return C.exp_manager["kwargs"]["uri"]
@default_uri.setter
def default_uri(self, value):
C.exp_manager.setdefault("kwargs", {})["uri"] = value
@property
def uri(self):
"""
Get the default tracking URI or current URI.View on GitHub (pinned to 79633dd950)
Solutions
- Restore the default MLflowExpManager so deletion reaches MLflow's delete_experiment.
- Implement delete_exp(self, experiment_id=None, experiment_name=None) in your subclass.
- Or delete directly through the backend API (mlflow.tracking.MlflowClient.delete_experiment) as a stopgap.
Example fix
# before ExpManager().delete_exp(experiment_name='old') # NotImplementedError # after R.delete_exp(experiment_name='old') # with default MLflowExpManager
Defensive patterns
Strategy: type-guard
Validate before calling
from qlib.workflow.expm import ExpManager assert R.exp_manager.__class__.delete_exp is not ExpManager.delete_exp, 'deletion unsupported'
Type guard
def manager_can_delete(mgr) -> bool:
from qlib.workflow.expm import ExpManager
return mgr.__class__.delete_exp is not ExpManager.delete_exp Prevention
- Delete experiments via R.delete_exp with the default MLflow manager.
- Note MLflow deletion is soft: ids remain but lifecycle_stage becomes DELETED.
When it happens
Trigger: R.delete_exp(experiment_name='x') or exp_manager.delete_exp(...) where the configured manager class is the base or an incomplete subclass.
Common situations: Housekeeping scripts pruning old experiments while a custom manager backend is configured; subclass implementations that cover listing but not deletion.
Related errors
- Please implement the `delete_recorder` method.
- Please implement the `start_exp` method.
- Please implement the `end_exp` method.
- Please implement the `create_exp` method.
- Please implement the `search_records` method.
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/25697dc2b96b4788.
Report an issue: GitHub.