pola-rs/polars · error · ValueError
`n_rows` cannot be used with `use_pyarrow=True` and `memory_
Error message
`n_rows` cannot be used with `use_pyarrow=True` and `memory_map=False`
What it means
Error "`n_rows` cannot be used with `use_pyarrow=True` and `memory_map=False`" thrown in pola-rs/polars.
Source
Thrown at py-polars/src/polars/io/ipc/functions.py:162
storage_options=storage_options,
row_index_name=row_index_name,
row_index_offset=row_index_offset,
rechunk=rechunk,
)
if columns:
if isinstance(columns[0], int):
lf = lf.select(F.nth(columns)) # type: ignore[arg-type]
else:
lf = lf.select(columns)
df = lf._collect_eager()
return df
if use_pyarrow and n_rows and not memory_map:
msg = "`n_rows` cannot be used with `use_pyarrow=True` and `memory_map=False`"
raise ValueError(msg)
with prepare_file_arg(
source, use_pyarrow=use_pyarrow, storage_options=storage_options
) as data:
if use_pyarrow:
pyarrow_ipc = import_optional(
"pyarrow.ipc",
err_prefix="",
err_suffix="is required when using 'read_ipc(..., use_pyarrow=True)'",
)
if columns is not None and is_non_empty_sequence_of(columns, str):
initial_pos: Any = None
if hasattr(data, "tell") and callable(data.tell):
initial_pos = data.tell()
with pyarrow_ipc.open_file(data) as ipc_f:View on GitHub (pinned to df599052da)
When it happens
Trigger: Thrown at py-polars/src/polars/io/ipc/functions.py:162 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@df599052da (2026-08-16).
Data as JSON: /api/errors/02519255ea4c52da.
Report an issue: GitHub.