pola-rs/polars · error · ModuleUpgradeRequiredError
`fastexcel` >= 0.10 is required to read bytes; found
Error message
`fastexcel` >= 0.10 is required to read bytes; found {module_version}) What it means
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.
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
Example fix
// before pl.read_excel(io.BytesIO(resp.content)) # fastexcel 0.7 // after # pip install -U 'fastexcel>=0.10' pl.read_excel(io.BytesIO(resp.content))
Defensive patterns
Strategy: validation
Validate before calling
import fastexcel
from packaging.version import parse
assert parse(fastexcel.__version__) >= parse('0.10'), 'upgrade fastexcel to read bytes' Try / catch
from polars.exceptions import ModuleUpgradeRequiredError
try:
df = pl.read_excel(io.BytesIO(data))
except ModuleUpgradeRequiredError:
df = pl.read_excel(write_temp_xlsx(data)) Prevention
- Pin 'fastexcel>=0.10' in requirements/pyproject
- Upgrade fastexcel whenever upgrading polars
- Fall back to temp-file reads when bytes are unsupported
When it happens
Trigger: `pl.read_excel(io.BytesIO(data))` or `pl.read_excel(raw_bytes)` with fastexcel < 0.10 installed.
Common situations: Pinned/locked fastexcel version in requirements.txt; stale environment after upgrading polars; reading in-memory Excel downloads in a service with old deps.
Understand the failure class
Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.
Related errors
- ` ` was removed in version
- the argument for has been removed in version . It was…
- a more recent version of `fastexcel` is required for…
- a more recent version of `fastexcel` is required for…
- a more recent version of `fastexcel` is required for…
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/92087a67579a9bd3.
Report an issue: GitHub.
Appendix: source
Thrown at py-polars/src/polars/io/spreadsheet/functions.py:882
openpyxl = import_optional("openpyxl")
if isinstance(source, bytes):
source = BytesIO(source)
parser = openpyxl.load_workbook(source, data_only=True, **engine_options)
sheets = [{"index": i + 1, "name": ws.title} for i, ws in enumerate(parser)]
return _read_spreadsheet_openpyxl, parser, sheets
elif engine == "calamine":
fastexcel = import_optional("fastexcel", min_version="0.7.0")
reading_bytesio, reading_bytes = (
isinstance(source, BytesIO),
isinstance(source, bytes),
)
if (reading_bytesio or reading_bytes) and parse_version(
module_version := fastexcel.__version__
) < (0, 10):
msg = f"`fastexcel` >= 0.10 is required to read bytes; found {module_version})"
raise ModuleUpgradeRequiredError(msg)
if reading_bytesio:
source = source.getvalue() # type: ignore[union-attr]
elif isinstance(source, (BufferedReader, TextIOWrapper)):
if "b" not in source.mode:
msg = f"file {source.name!r} must be opened in binary mode"
raise OSError(msg)
elif (filename := source.name) and Path(filename).exists():
source = filename
else:
source = source.read()
parser = fastexcel.read_excel(source, **engine_options)
sheets = [
{"index": i + 1, "name": nm} for i, nm in enumerate(parser.sheet_names)
]
return _read_spreadsheet_calamine, parser, sheets
View on GitHub (pinned to fe841f959e)