microsoft/qlib · warning · FileNotFoundError

We can't find the project path

Error message

We can't find the project path

What it means

DatasetCache._dataset (qlib/data/cache.py:432) is the abstract method that reads a cached feature dataset. The base raises NotImplementedError, but the public dataset() wrapper catches it and delegates to self.provider.dataset(...) — so data loading still succeeds, just uncached, whenever the subclass (or base) lacks a real _dataset implementation.

Source

Thrown at qlib/__init__.py:239

        NOTE: link is not supported here.


    This method is often used when
    - user want to use a relative config path instead of hard-coding qlib config path in code

    Raises
    ------
    FileNotFoundError:
        If project path is not found
    """
    if cur_path is None:
        cur_path = Path(__file__).absolute().resolve()
    cur_path = Path(cur_path)
    while True:
        if (cur_path / config_name).exists():
            return cur_path
        if cur_path == cur_path.parent:
            raise FileNotFoundError("We can't find the project path")
        cur_path = cur_path.parent


def auto_init(**kwargs):
    """
    This function will init qlib automatically with following priority
    - Find the project configuration and init qlib
        - The parsing process will be affected by the `conf_type` of the configuration file
    - Init qlib with default config
    - Skip initialization if already initialized

    :**kwargs: it may contain following parameters
                cur_path: the start path to find the project path

    Here are two examples of the configuration

    Example 1)
    If you want to create a new project-specific config based on a shared configure, you can use  `conf_type: ref`

View on GitHub (pinned to 79633dd950)

Solutions

  1. Use DiskDatasetCache (file-backed), or SimpleDatasetCache/DatasetURICache as appropriate
  2. Override _dataset(self, instruments, fields, start_time=None, end_time=None, freq='day', disk_cache=1, inst_processors=[]) -> pd.DataFrame to read your backend
  3. Verify the override signature matches exactly, including inst_processors

Example fix

# before
qlib.init(dataset_cache=DatasetCache)  # abstract; silent no-cache fallback

# after
from qlib.data.cache import DiskDatasetCache
qlib.init(dataset_cache=DiskDatasetCache)
Defensive patterns

Strategy: fallback

Validate before calling

from qlib.data.cache import DatasetCache

if MyDSCache._dataset is DatasetCache._dataset:
    print("WARNING: dataset cache disabled (falls back to provider)")

Try / catch

# dataset() already falls back to provider.dataset on NotImplementedError;
# verify caching actually happens by checking cache dir size after runs

Prevention

When it happens

Trigger: Registering a DatasetCache subclass without overriding _dataset: D.features(...) works but never hits a dataset cache; calling _dataset directly always raises; commonly co-occurs with error at cache.py:423 because _uri is also unimplemented and has no fallback.

Common situations: Custom dataset cache classes where only constructor/init changed; misconfiguring dataset_cache to the abstract base instead of DiskDatasetCache.

Related errors


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