microsoft/qlib · error · ValueError

Unknown pickle backend, please use 'pickle' or 'dill'.

Error message

Unknown pickle backend, please use 'pickle' or 'dill'.

What it means

Error "Unknown pickle backend, please use 'pickle' or 'dill'." thrown in microsoft/qlib.

Source

Thrown at qlib/utils/serial.py:170

            return object
        else:
            raise TypeError(f"The instance of {type(object)} is not a valid `{type(cls)}`!")

    @classmethod
    def get_backend(cls):
        """
        Return the real backend of a Serializable class. The pickle_backend value can be "pickle" or "dill".

        Returns:
            module: pickle or dill module based on pickle_backend
        """
        # NOTE: pickle interface like backend; such as dill
        if cls.pickle_backend == "pickle":
            return pickle
        elif cls.pickle_backend == "dill":
            return dill
        else:
            raise ValueError("Unknown pickle backend, please use 'pickle' or 'dill'.")

    @staticmethod
    def general_dump(obj, path: Union[Path, str]):
        """
        A general dumping method for object

        Parameters
        ----------
        obj : object
            the object to be dumped
        path : Union[Path, str]
            the target path the data will be dumped
        """
        path = Path(path)
        if isinstance(obj, Serializable):
            obj.to_pickle(path)
        else:
            with path.open("wb") as f:

View on GitHub (pinned to 79633dd950)

Solutions

  1. Set the pickle backend to 'pickle' or 'dill' in your configuration.
  2. Install dill (`pip install dill`) if you configured the 'dill' backend.

When it happens

Trigger: This error is raised at qlib/utils/serial.py:170 when the guard condition fails: "Unknown pickle backend". It triggers when the code path receives input or a state that violates the precondition checked at this point — e.g. an unimplemented abstract method being called, an unsupported argument type/value, or an invalid configuration. To avoid it, satisfy the documented precondition before this call: implement the required method in your subclass, or pass a supported value of the expected type as described by the message.

Common situations: See trigger scenarios.


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