microsoft/qlib · error · NotImplementedError
Please implement the `start_exp` method.
Error message
Please implement the `start_exp` method.
What it means
ExpManager is qlib's abstract experiment-manager base class; the public start_exp handles bookkeeping (active URI) then delegates to _start_exp, whose base implementation raises NotImplementedError. Only concrete managers (MLflowExpManager) implement it, so this error means the abstract manager, or a subclass missing _start_exp, was used to start an experiment.
Source
Thrown at qlib/workflow/expm.py:96
Returns
-------
An active experiment.
"""
self._active_exp_uri = uri
# The subclass may set the underlying uri back.
# So setting `_active_exp_uri` come before `_start_exp`
return self._start_exp(
experiment_id=experiment_id,
experiment_name=experiment_name,
recorder_id=recorder_id,
recorder_name=recorder_name,
resume=resume,
**kwargs,
)
def _start_exp(self, *args, **kwargs) -> Experiment:
"""Please refer to the doc of `start_exp`"""
raise NotImplementedError(f"Please implement the `start_exp` method.")
def end_exp(self, recorder_status: Text = Recorder.STATUS_S, **kwargs):
"""
End an active experiment.
Maintaining `_active_exp_uri` is included in end_exp, remaining implementation should be included in _end_exp in subclass
Parameters
----------
experiment_name : str
name of the active experiment.
recorder_status : str
the status of the active recorder of the experiment.
"""
self._active_exp_uri = None
# The subclass may set the underlying uri back.
# So setting `_active_exp_uri` come before `_end_exp`
self._end_exp(recorder_status=recorder_status, **kwargs)View on GitHub (pinned to 79633dd950)
Solutions
- Restore the default: C.exp_manager = {'class': 'MLflowExpManager', 'kwargs': {'uri': ...}} in qlib.init.
- In your custom manager subclass, implement _start_exp(experiment_id, experiment_name, recorder_id, recorder_name, resume, **kwargs) returning an Experiment.
- Verify the configured class actually subclasses ExpManager AND overrides the private hooks, not just the public methods.
Example fix
# before
qlib.init(exp_manager={'class': 'ExpManager', 'kwargs': {'uri': 'file:./mlruns'}})
R.start_exp() # NotImplementedError
# after
qlib.init() # defaults to MLflowExpManager
R.start_exp(record_name='test') Defensive patterns
Strategy: type-guard
Validate before calling
from qlib.workflow.expm import ExpManager assert type(R.exp_manager) is not ExpManager and R.exp_manager.__class__._start_exp is not ExpManager._start_exp
Type guard
def manager_can_start(mgr) -> bool:
from qlib.workflow.expm import ExpManager
return mgr.__class__._start_exp is not ExpManager._start_exp Prevention
- Run R.start_exp only after qlib.init() with the default MLflowExpManager or a complete custom manager.
- Unit-test custom managers against every ExpManager hook before wiring them into config.
When it happens
Trigger: R.start_exp(...) after C['exp_manager']['class'] was set to the base 'ExpManager' or to a custom class that does not override _start_exp; directly instantiating ExpManager and calling start_exp.
Common situations: Customizing qlib config to point at a user-written tracking manager that is still a skeleton; typos in the configured class name that happen to resolve to the base class; code written against an internal fork missing the method.
Related errors
- Please implement the `end_exp` method.
- Please implement the `create_exp` method.
- Please implement the `search_records` method.
- Please implement the `_get_exp` method
- Please implement the `delete_exp` method.
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/3dcc1dfd5e3baf65.
Report an issue: GitHub.