microsoft/qlib · error · FileNotFoundError

Can't find the BASE_CONFIG file: {base_config_path}

Error message

Can't find the BASE_CONFIG file: {base_config_path}

What it means

In qlib/cli/run.py, a workflow config may reference a base config via BASE_CONFIG_PATH so common settings can be shared. qlib first tries the path as given (relative to the current working directory or absolute), then relative to the directory of the main config file. If neither exists, it raises FileNotFoundError — the base YAML simply is not on disk where qlib looked.

Source

Thrown at qlib/cli/run.py:127

    base_config_path = config.get("BASE_CONFIG_PATH", None)
    if base_config_path:
        logger.info(f"Use BASE_CONFIG_PATH: {base_config_path}")
        base_config_path = Path(base_config_path)

        # it will find config file in absolute path and relative path
        if base_config_path.exists():
            path = base_config_path
        else:
            logger.info(
                f"Can't find BASE_CONFIG_PATH base on: {Path.cwd()}, "
                f"try using relative path to config path: {Path(config_path).absolute()}"
            )
            relative_path = Path(config_path).absolute().parent.joinpath(base_config_path)
            if relative_path.exists():
                path = relative_path
            else:
                raise FileNotFoundError(f"Can't find the BASE_CONFIG file: {base_config_path}")

        with open(path) as fp:
            yaml = YAML(typ="safe", pure=True)
            base_config = yaml.load(fp)
        logger.info(f"Load BASE_CONFIG_PATH succeed: {path.resolve()}")
        config = update_config(base_config, config)

    # config the `sys` section
    sys_config(config, config_path)

    if "exp_manager" in config.get("qlib_init"):
        qlib.init(**config.get("qlib_init"))
    else:
        exp_manager = C["exp_manager"]
        exp_manager["kwargs"]["uri"] = "file:" + str(Path(os.getcwd()).resolve() / uri_folder)
        qlib.init(**config.get("qlib_init"), exp_manager=exp_manager)

    if "experiment_name" in config:

View on GitHub (pinned to 79633dd950)

Solutions

  1. Place the base config next to your main config file (config-dir-relative lookup is the most robust) or use an absolute path for BASE_CONFIG_PATH.
  2. Run qrun from the directory the relative BASE_CONFIG_PATH was written against.
  3. Verify the file exists: 'ls <BASE_CONFIG_PATH>' from the exact directory you invoke qrun in; fix typos/case (case-sensitive on Linux).

Example fix

# before (run from ~/project, config in ~/project/examples)
BASE_CONFIG_PATH: base.yaml  # missing at ~/project/base.yaml
# after
BASE_CONFIG_PATH: examples/base.yaml  # or an absolute path: /home/me/project/examples/base.yaml
Defensive patterns

Strategy: try-catch

Validate before calling

from pathlib import Path
base = Path(cfg['qlib_init'].get('BASE_CONFIG_PATH', 'base.yaml'))
if not base.exists():
    base = Path(config_path).absolute().parent / base
assert base.exists(), f'BASE_CONFIG_PATH not found: {base}'

Try / catch

try:
    run_workflow('config.yaml')
except FileNotFoundError as e:
    if 'BASE_CONFIG' in str(e):
        # retry from the config's own directory where relative lookup applies
        os.chdir(config_dir)
        run_workflow('config.yaml')
    else:
        raise

Prevention

When it happens

Trigger: Running 'qrun config.yaml' (or workflow activation) where config.yaml sets BASE_CONFIG_PATH: base.yaml and base.yaml does not exist at CWD-relative or config-dir-relative location; commonly the file was renamed, deleted, or the command is run from a different directory.

Common situations: Cloning an examples/workflow repo that ships base_workflow_config.yaml but running qrun from another directory; CI jobs that cd elsewhere before qrun; path typos or Windows backslash separators in the YAML value.

Related errors


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