pola-rs/polars · error · ModuleNotFoundError

deltalake is not installed Please run: pip install deltalak

Error message

deltalake is not installed

Please run: pip install deltalake

What it means

Raised as ModuleNotFoundError by the delta helpers when the optional deltalake package is not installed. All delta-lake functionality in polars (scan_delta, read_delta, write_delta, DeltaTable handling) is gated on this dependency, and the message includes the install command.

Source

Thrown at py-polars/src/polars/io/delta/_utils.py:95

            version=version,
            storage_options=storage_options,
            **delta_table_options,
        )
    else:
        dl_tbl = deltalake.DeltaTable(
            table_path,
            storage_options=storage_options,
            **delta_table_options,
        )
        dl_tbl.load_as_version(version)

    return dl_tbl


def _check_if_delta_available() -> None:
    if not _DELTALAKE_AVAILABLE:
        msg = "deltalake is not installed\n\nPlease run: pip install deltalake"
        raise ModuleNotFoundError(msg)


def _check_for_unsupported_types(dtypes: list[DataType]) -> None:
    schema_dtypes = unpack_dtypes(*dtypes)
    unsupported_types = {Time, Null}
    # Note that this overlap check does NOT work correctly for Categorical, so
    # if Categorical is added back to unsupported_types a different check will
    # need to be used.

    if overlap := schema_dtypes & unsupported_types:
        msg = f"dataframe contains unsupported data types: {overlap!r}"
        raise TypeError(msg)


def _extract_table_statistics_from_delta_add_actions(
    add_actions_df: DataFrame,
    *,
    filter_columns: list[str],

View on GitHub (pinned to df599052da)

Solutions

  1. Install the dependency: pip install deltalake
  2. Or add the extra when installing polars if your workflow documents one (e.g. pip install 'polars[delta]' where supported)
  3. Pin deltalake>=1.4.2 if you also need deletion-vector reads

Example fix

# before: ModuleNotFoundError: deltalake is not installed
pl.scan_delta("./delta_table").collect()

# after
pip install deltalake
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util

if importlib.util.find_spec("deltalake") is None:
    raise ModuleNotFoundError("pip install deltalake before running delta pipelines")

Prevention

When it happens

Trigger: Calling pl.scan_delta / pl.read_delta / pl.write_delta in an environment where deltalake is not installed (polars does not ship it by default).

Common situations: Fresh environments or slim Docker images with plain pip install polars; CI caches that drop optional extras; adding polars delta code to a service that never needed delta before.

Related errors


AI-assisted analysis of pola-rs/polars@df599052da (2026-08-16). Data as JSON: /api/errors/903565625b26cf3a. Report an issue: GitHub.