{"record":{"id":"92087a67579a9bd3","repo":"pola-rs/polars","slug":"fastexcel-0-10-is-required-to-read-bytes-fou","errorCode":null,"errorMessage":"`fastexcel` >= 0.10 is required to read bytes; found {module_version})","messagePattern":"`fastexcel` >= 0\\.10 is required to read bytes; found (.+?)\\)","errorType":"exception","errorClass":"ModuleUpgradeRequiredError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/spreadsheet/functions.py","lineNumber":882,"sourceCode":"        openpyxl = import_optional(\"openpyxl\")\n        if isinstance(source, bytes):\n            source = BytesIO(source)\n\n        parser = openpyxl.load_workbook(source, data_only=True, **engine_options)\n        sheets = [{\"index\": i + 1, \"name\": ws.title} for i, ws in enumerate(parser)]\n        return _read_spreadsheet_openpyxl, parser, sheets\n\n    elif engine == \"calamine\":\n        fastexcel = import_optional(\"fastexcel\", min_version=\"0.7.0\")\n        reading_bytesio, reading_bytes = (\n            isinstance(source, BytesIO),\n            isinstance(source, bytes),\n        )\n        if (reading_bytesio or reading_bytes) and parse_version(\n            module_version := fastexcel.__version__\n        ) < (0, 10):\n            msg = f\"`fastexcel` >= 0.10 is required to read bytes; found {module_version})\"\n            raise ModuleUpgradeRequiredError(msg)\n\n        if reading_bytesio:\n            source = source.getvalue()  # type: ignore[union-attr]\n        elif isinstance(source, (BufferedReader, TextIOWrapper)):\n            if \"b\" not in source.mode:\n                msg = f\"file {source.name!r} must be opened in binary mode\"\n                raise OSError(msg)\n            elif (filename := source.name) and Path(filename).exists():\n                source = filename\n            else:\n                source = source.read()\n\n        parser = fastexcel.read_excel(source, **engine_options)\n        sheets = [\n            {\"index\": i + 1, \"name\": nm} for i, nm in enumerate(parser.sheet_names)\n        ]\n        return _read_spreadsheet_calamine, parser, sheets\n","sourceCodeStart":864,"sourceCodeEnd":900,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/spreadsheet/functions.py#L864-L900","documentation":"Reading Excel data from bytes or a BytesIO requires `fastexcel` >= 0.10; if the installed version is older, `_initialise_spreadsheet_parser` raises `ModuleUpgradeRequiredError` reporting the found version.","triggerScenarios":"`pl.read_excel(io.BytesIO(data))` or `pl.read_excel(raw_bytes)` with fastexcel < 0.10 installed.","commonSituations":"Pinned/locked fastexcel version in requirements.txt; stale environment after upgrading polars; reading in-memory Excel downloads in a service with old deps.","solutions":["Upgrade: `pip install -U 'fastexcel>=0.10'`","Write bytes to a temp file and pass the path instead","Update the dependency pin in requirements/pyproject"],"exampleFix":"// before\npl.read_excel(io.BytesIO(resp.content))  # fastexcel 0.7\n// after\n# pip install -U 'fastexcel>=0.10'\npl.read_excel(io.BytesIO(resp.content))","handlingStrategy":"validation","validationCode":"import fastexcel\nfrom packaging.version import parse\nassert parse(fastexcel.__version__) >= parse('0.10'), 'upgrade fastexcel to read bytes'","typeGuard":null,"tryCatchPattern":"from polars.exceptions import ModuleUpgradeRequiredError\ntry:\n    df = pl.read_excel(io.BytesIO(data))\nexcept ModuleUpgradeRequiredError:\n    df = pl.read_excel(write_temp_xlsx(data))","preventionTips":["Pin 'fastexcel>=0.10' in requirements/pyproject","Upgrade fastexcel whenever upgrading polars","Fall back to temp-file reads when bytes are unsupported"],"tags":["python","polars","fastexcel","version","bytes"],"backgroundTag":"missing-optional-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"}