microsoft/qlib · error · NotImplementedError
Please implement the `create_exp` method.
Error message
Please implement the `create_exp` method.
What it means
ExpManager.create_exp is abstract: it must create an experiment with a unique name and return an Experiment object (raising ExpAlreadyExistError on duplicates in concrete backends). The base stub raising NotImplementedError means no concrete manager (e.g. MLflowExpManager) performed the creation.
Solutions
- Keep C['exp_manager']['class'] = 'MLflowExpManager' (default) so creation goes to MLflow.
- Implement create_exp(self, experiment_name=None) in your subclass, raising ExpAlreadyExistError on duplicates.
- Use R.get_exp(experiment_name=..., create=True) which handles creation through the concrete manager.
Example fix
# before
ExpManager().create_exp('alpha158') # NotImplementedError
# after
exp = R.get_exp(experiment_name='alpha158', create=True) # via MLflowExpManager Defensive patterns
Strategy: type-guard
Validate before calling
from qlib.workflow.expm import ExpManager assert R.exp_manager.__class__.create_exp is not ExpManager.create_exp, 'creation unsupported'
Type guard
def manager_can_create(mgr) -> bool:
from qlib.workflow.expm import ExpManager
return mgr.__class__.create_exp is not ExpManager.create_exp Prevention
- Create experiments through R.get_exp(create=True) with the default manager.
- Keep custom managers complete before pointing C['exp_manager'] at them.
When it happens
Trigger: exp_manager.create_exp('name') on a bare ExpManager; get_exp(create=True) routing creation through a custom manager subclass that lacks create_exp.
Common situations: Custom manager backends under construction; config switched away from MLflowExpManager while workflow code still assumes experiment auto-creation.
Related errors
- Please implement the `delete_exp` method.
- Please implement the `end_exp` method.
- Please implement the `_get_exp` method
- Please implement the `list_experiments` method.
- Please implement the `search_records` method.
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/a08d8974c5144b7e.
Report an issue: GitHub.
Appendix: source
Thrown at qlib/workflow/expm.py:136
def create_exp(self, experiment_name: Optional[Text] = None):
"""
Create an experiment.
Parameters
----------
experiment_name : str
the experiment name, which must be unique.
Returns
-------
An experiment object.
Raise
-----
ExpAlreadyExistError
"""
raise NotImplementedError(f"Please implement the `create_exp` method.")
def search_records(self, experiment_ids=None, **kwargs):
"""
Get a pandas DataFrame of records that fit the search criteria of the experiment.
Inputs are the search criteria user want to apply.
Returns
-------
A pandas.DataFrame of records, where each metric, parameter, and tag
are expanded into their own columns named metrics.*, params.*, and tags.*
respectively. For records that don't have a particular metric, parameter, or tag, their
value will be (NumPy) Nan, None, or None respectively.
"""
raise NotImplementedError(f"Please implement the `search_records` method.")
def get_exp(self, *, experiment_id=None, experiment_name=None, create: bool = True, start: bool = False):
"""
Retrieve an experiment. This method includes getting an active experiment, and get_or_create a specific experiment.View on GitHub (pinned to 79633dd950)