pola-rs/polars · error · ValueError

a more recent version of `fastexcel` is required for…

Error message

a more recent version of `fastexcel` is required for 'table_name' (>= 0.12.0; found {original_version})

What it means

Reading a named Excel table via the calamine engine requires fastexcel >= 0.12, which introduced `load_table`. When `table_name` is supplied and the installed fastexcel is older, polars raises ValueError stating the required minimum version and the found version.

Solutions

  1. Upgrade fastexcel: pip install -U 'fastexcel>=0.12'.
  2. Pin fastexcel>=0.12 where named-table reading is used.
  3. Fall back to reading the sheet and filtering rows to the table range manually if upgrade is not possible.

Example fix

// before
# fastexcel 0.10 installed
pl.read_excel('f.xlsx', engine='calamine', table_name='SalesTable')
// after
# pip install -U 'fastexcel>=0.12'
pl.read_excel('f.xlsx', engine='calamine', table_name='SalesTable')
Defensive patterns

Strategy: validation

Validate before calling

from importlib.metadata import version
from packaging.version import Version
if table_name and Version(version('fastexcel')) < Version('0.12'):
    raise RuntimeError('fastexcel>=0.12 required for table_name')

Try / catch

try:
    df = pl.read_excel(path, engine='calamine', table_name=table_name)
except (ValueError, ModuleUpgradeRequiredError) as e:
    log.warning('Named-table read unavailable: %s', e)
    df = pl.read_excel(path, engine='calamine', sheet_name=sheet_name)

Prevention

When it happens

Trigger: `pl.read_excel('f.xlsx', engine='calamine', table_name='Table1')` with fastexcel < 0.12 installed.

Common situations: Attempting to read Excel named tables with an old fastexcel; stale requirements; upgrading polars (which added table support) without upgrading fastexcel.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/5344556842c80048. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/io/spreadsheet/functions.py:1057

    table_name: str | None = None,
    drop_empty_rows: bool,
    drop_empty_cols: bool,
    raise_if_empty: bool,
) -> pl.DataFrame:
    # if we have 'schema_overrides' and a more recent version of `fastexcel`
    # we can pass translated dtypes to the engine to refine the initial parse
    fastexcel = import_optional("fastexcel")
    fastexcel_version = parse_version(original_version := fastexcel.__version__)

    if fastexcel_version < (0, 9) and "schema_sample_rows" in read_options:
        msg = f"a more recent version of `fastexcel` is required for 'schema_sample_rows' (>= 0.9; found {original_version})"
        raise ModuleUpgradeRequiredError(msg)
    if fastexcel_version < (0, 10, 2) and "use_columns" in read_options:
        msg = f"a more recent version of `fastexcel` is required for 'use_columns' (>= 0.10.2; found {original_version})"
        raise ModuleUpgradeRequiredError(msg)
    if table_name and fastexcel_version < (0, 12):
        msg = f"a more recent version of `fastexcel` is required for 'table_name' (>= 0.12.0; found {original_version})"
        raise ValueError(msg)

    if columns:
        if not isinstance(columns, list):
            columns = list(columns)  # type: ignore[assignment]
        read_options["use_columns"] = columns

    schema_overrides = schema_overrides or {}
    if read_options.get("schema_sample_rows") == 0:
        # ref: https://github.com/ToucanToco/fastexcel/issues/236
        del read_options["schema_sample_rows"]
        read_options["dtypes"] = (
            "string"
            if fastexcel_version >= (0, 12, 1)
            else dict.fromkeys(range(16384), "string")
        )
    elif schema_overrides and fastexcel_version >= (0, 10):
        parser_dtypes = read_options.get("dtypes", {})
        for name, dtype in schema_overrides.items():

View on GitHub (pinned to fe841f959e)