microsoft/qlib · error · NotImplementedError

This type of uri is not supported

Error message

This type of uri is not supported

What it means

QlibConfig.DataPathManager.get_uri_type classifies URIs as LOCAL (posix absolute path or windows drive) or NFS (host:/path pattern). When resolving the data path for a frequency, a URI that classifies as neither raises NotImplementedError. In practice a URI that is empty or has an unrecognized shape (no leading '/', no drive letter, no 'host:' prefix — e.g. a bare relative name) falls through to this branch.

Source

Thrown at qlib/config.py:405

        def get_data_uri(self, freq: Optional[Union[str, Freq]] = None) -> Path:
            """
            please refer DataPathManager's __init__ and class doc
            """
            if freq is not None:
                freq = str(freq)  # converting Freq to string
            if freq is None or freq not in self.provider_uri:
                freq = QlibConfig.DEFAULT_FREQ
            _provider_uri = self.provider_uri[freq]
            if self.get_uri_type(_provider_uri) == QlibConfig.LOCAL_URI:
                return Path(_provider_uri)
            elif self.get_uri_type(_provider_uri) == QlibConfig.NFS_URI:
                if "win" in platform.system().lower():
                    # windows, mount_path is the drive
                    _path = str(self.mount_path[freq])
                    return Path(f"{_path}:\\") if ":" not in _path else Path(_path)
                return Path(self.mount_path[freq])
            else:
                raise NotImplementedError(f"This type of uri is not supported")

    def set_mode(self, mode):
        # raise KeyError
        self.update(MODE_CONF[mode])
        # TODO: update region based on kwargs

    def set_region(self, region):
        # raise KeyError
        self.update(_default_region_config[region])

    @staticmethod
    def is_depend_redis(cache_name: str):
        return cache_name in DEPENDENCY_REDIS_CACHE

    @property
    def dpm(self):
        return self.DataPathManager(self["provider_uri"], self["mount_path"])

View on GitHub (pinned to 79633dd950)

Solutions

  1. Use an absolute path for local data: provider_uri='/home/me/qlib_data' or '~/.qlib/qlib_data' (tilde is expanded).
  2. For remote data use the 'host:/path' NFS form and ensure mount_path is provided per frequency on systems requiring mounting.
  3. Validate your provider_uri with QlibConfig.DataPathManager.get_uri_type(uri) during setup and fail early if it returns neither LOCAL nor NFS.

Example fix

# before
qlib.init(provider_uri='qlib_data')  # bare relative name -> NotImplementedError
# after
qlib.init(provider_uri=str(Path('qlib_data').resolve()))  # absolute local path
Defensive patterns

Strategy: validation

Validate before calling

from qlib.config import QlibConfig
uri_type = QlibConfig.DataPathManager.get_uri_type(str(provider_uri))
if uri_type not in (QlibConfig.LOCAL_URI, QlibConfig.NFS_URI):
    raise ValueError(f'provider_uri {provider_uri!r} is neither a local path nor host:/path NFS form')

Prevention

When it happens

Trigger: provider_uri values like '' (empty string), 'data' (bare relative name with no scheme), or exotic schemes on some platforms reach get_data_uri_path and match neither URI pattern. On Windows, mount-path handling only covers the NFS branch, so malformed mount entries also land here.

Common situations: Relative provider_uri strings that were never expanded to absolute paths (normalization usually resolves local URIs, but empty/odd strings can escape it); configs generated by templating that leave a placeholder value; Windows setups where mount_path is missing for an NFS-configured frequency.

Related errors


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