{"record":{"id":"67d02cad25c38074","repo":"pola-rs/polars","slug":"use-pyarrow-true-is-not-supported-for-hugging-fa","errorCode":null,"errorMessage":"`use_pyarrow=True` is not supported for Hugging Face","messagePattern":"`use_pyarrow=True` is not supported for Hugging Face","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/ipc/functions.py","lineNumber":141,"sourceCode":"          E.g. `pl.read_ipc(\"my_file.arrow\").write_ipc(\"my_file.arrow\")`\n          will fail.\n    \"\"\"\n    projection, column_names = parse_columns_arg(columns)\n    del columns\n    row_index = parse_row_index_args(row_index_name, row_index_offset)\n    del row_index_name\n    del row_index_offset\n\n    if use_pyarrow:\n        if n_rows:\n            msg = (\n                \"`n_rows` cannot be used with `use_pyarrow=True` and `memory_map=False`\"\n            )\n            raise ValueError(msg)\n\n        if (isinstance(v := source, (str, Path))) and str(v).startswith(\"hf://\"):\n            msg = \"`use_pyarrow=True` is not supported for Hugging Face\"\n            raise ValueError(msg)\n\n        with prepare_file_arg(\n            source, use_pyarrow=use_pyarrow, storage_options=storage_options\n        ) as data:\n            pyarrow_ipc = import_optional(\n                \"pyarrow.ipc\",\n                err_prefix=\"\",\n                err_suffix=\"is required when using 'read_ipc(..., use_pyarrow=True)'\",\n            )\n\n            if column_names is not None:\n                initial_pos: Any = None\n\n                if hasattr(data, \"tell\") and callable(data.tell):\n                    initial_pos = data.tell()\n\n                with pyarrow_ipc.open_file(data) as ipc_f:\n                    schema = ipc_f.schema","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/ipc/functions.py#L123-L159","documentation":"Polars' read_ipc supports a fast-path via pyarrow, but only when reading from ordinary file paths. Sources on the Hugging Face Hub (hf:// URLs) are streamed through Polars' own cloud storage layer, which the pyarrow-based IPC reader cannot consume, so this combination is rejected up front with a ValueError.","triggerScenarios":"Calling pl.read_ipc (or read_ipc_schema variants routed through it) with use_pyarrow=True and a source string/Path that starts with 'hf://'.","commonSituations":"Migrating code from local/s3 IPC reads to Hugging Face datasets; copy-pasting use_pyarrow=True from older code while switching source to hf:// URIs.","solutions":["Remove use_pyarrow=True (let Polars use its native IPC reader, which supports hf:// sources)","Read the file with use_pyarrow=False or the default","Download the hf:// file locally first, then read_ipc the local path with use_pyarrow=True","Use pl.scan_ipc(...).collect() instead of the pyarrow path"],"exampleFix":"// before\npl.read_ipc('hf://datasets/my-org/my-dset/data.feather', use_pyarrow=True)\n// after\npl.read_ipc('hf://datasets/my-org/my-dset/data.feather')","handlingStrategy":"validation","validationCode":"if use_pyarrow and isinstance(source, (str, Path)) and str(source).startswith('hf://'):\n    raise ValueError('use_pyarrow=True is unsupported for hf:// sources')","typeGuard":"def is_hf_source(source) -> bool:\n    return isinstance(source, (str, Path)) and str(source).startswith('hf://')","tryCatchPattern":null,"preventionTips":["Never combine use_pyarrow=True with hf:// sources","Check backend-compatibility docs before forcing use_pyarrow","Prefer Polars' native readers for cloud/Hub sources"],"tags":["polars","ipc","pyarrow","hugging-face"],"backgroundTag":"conflicting-config-options","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"}