{"record":{"id":"4582c39f841d6670","repo":"pola-rs/polars","slug":"a-more-recent-version-of-fastexcel-is-required-f","errorCode":null,"errorMessage":"a more recent version of `fastexcel` is required for 'use_columns' (>= 0.10.2; found {original_version})","messagePattern":"a more recent version of `fastexcel` is required for 'use_columns' \\(>= 0\\.10\\.2; found (.+?)\\)","errorType":"exception","errorClass":"ModuleUpgradeRequiredError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/spreadsheet/functions.py","lineNumber":1051,"sourceCode":"    parser: Any,\n    *,\n    sheet_name: str | None,\n    read_options: dict[str, Any],\n    schema_overrides: SchemaDict | None,\n    columns: Sequence[int] | Sequence[str] | None,\n    table_name: str | None = None,\n    drop_empty_rows: bool,\n    drop_empty_cols: bool,\n    raise_if_empty: bool,\n) -> pl.DataFrame:\n    # if we have 'schema_overrides' and a more recent version of `fastexcel`\n    # we can pass translated dtypes to the engine to refine the initial parse\n    fastexcel = import_optional(\"fastexcel\")\n    fastexcel_version = parse_version(original_version := fastexcel.__version__)\n\n    if fastexcel_version < (0, 9) and \"schema_sample_rows\" in read_options:\n        msg = f\"a more recent version of `fastexcel` is required for 'schema_sample_rows' (>= 0.9; found {original_version})\"\n        raise ModuleUpgradeRequiredError(msg)\n    if fastexcel_version < (0, 10, 2) and \"use_columns\" in read_options:\n        msg = f\"a more recent version of `fastexcel` is required for 'use_columns' (>= 0.10.2; found {original_version})\"\n        raise ModuleUpgradeRequiredError(msg)\n    if table_name and fastexcel_version < (0, 12):\n        msg = f\"a more recent version of `fastexcel` is required for 'table_name' (>= 0.12.0; found {original_version})\"\n        raise ValueError(msg)\n\n    if columns:\n        if not isinstance(columns, list):\n            columns = list(columns)  # type: ignore[assignment]\n        read_options[\"use_columns\"] = columns\n\n    schema_overrides = schema_overrides or {}\n    if read_options.get(\"schema_sample_rows\") == 0:\n        # ref: https://github.com/ToucanToco/fastexcel/issues/236\n        del read_options[\"schema_sample_rows\"]\n        read_options[\"dtypes\"] = (\n            \"string\"","sourceCodeStart":1033,"sourceCodeEnd":1069,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/spreadsheet/functions.py#L1033-L1069","documentation":"The calamine engine delegates to the optional `fastexcel` package, and the `use_columns` read option only exists in fastexcel >= 0.10.2. When the installed fastexcel is older and `use_columns` appears in read_options, polars raises ModuleUpgradeRequiredError naming the required and found versions. It is a dependency-version gate, not a usage mistake.","triggerScenarios":"`pl.read_excel(..., engine='calamine', read_options={'use_columns': [...]})` (or `columns=` translated into use_columns) with fastexcel < 0.10.2 installed.","commonSituations":"Pinned/locked fastexcel version in requirements.txt; OS distro packages shipping old fastexcel; environments where polars was upgraded but fastexcel was not.","solutions":["Upgrade fastexcel: pip install -U 'fastexcel>=0.10.2'.","Pin fastexcel>=0.10.2 in requirements/pyproject.","Remove the use_columns/columns argument if upgrading is impossible, and filter columns afterwards with df.select(...)."],"exampleFix":"// before\n# fastexcel 0.9.0 installed\npl.read_excel('f.xlsx', engine='calamine', columns=['a', 'b'])\n// after\n# pip install -U 'fastexcel>=0.10.2'\npl.read_excel('f.xlsx', engine='calamine', columns=['a', 'b'])","handlingStrategy":"validation","validationCode":"from importlib.metadata import version\nfrom packaging.version import Version\nif Version(version('fastexcel')) < Version('0.10.2'):\n    raise RuntimeError('fastexcel>=0.10.2 required for use_columns')","typeGuard":null,"tryCatchPattern":"try:\n    df = pl.read_excel(path, engine='calamine', columns=cols)\nexcept ModuleUpgradeRequiredError:\n    df = pl.read_excel(path, engine='calamine').select(cols)  # fallback without use_columns","preventionTips":["Pin 'fastexcel>=0.10.2' in pyproject/requirements","Keep fastexcel and polars upgraded together","Check fastexcel.__version__ at startup if optional read options are used"],"tags":["polars","fastexcel","dependency-version"],"backgroundTag":"missing-dependency","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}