{"record":{"id":"b2924538b4fd643c","repo":"pola-rs/polars","slug":"pyarrow-8-0-0-is-required-for-to-pandas-use-pyar-b29245","errorCode":null,"errorMessage":"pyarrow>=8.0.0 is required for `to_pandas(use_pyarrow_extension_array=True)`","messagePattern":"pyarrow>=8\\.0\\.0 is required for `to_pandas\\(use_pyarrow_extension_array=True\\)`","errorType":"exception","errorClass":"ModuleNotFoundError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/dataframe/frame.py","lineNumber":2622,"sourceCode":"        foo           int64[pyarrow]\n        bar          double[pyarrow]\n        ham    large_string[pyarrow]\n        dtype: object\n        \"\"\"\n        if self.width == 0:\n            return pd.DataFrame(index=range(self.height))\n\n        if use_pyarrow_extension_array:\n            if parse_version(pd.__version__) < (1, 5):\n                msg = f'pandas>=1.5.0 is required for `to_pandas(\"use_pyarrow_extension_array=True\")`, found Pandas {pd.__version__!r}'\n                raise ModuleUpgradeRequiredError(msg)\n            if not _PYARROW_AVAILABLE or parse_version(pa.__version__) < (8, 0):\n                msg = \"pyarrow>=8.0.0 is required for `to_pandas(use_pyarrow_extension_array=True)`\"\n                if _PYARROW_AVAILABLE:\n                    msg += f\", found pyarrow {pa.__version__!r}.\"\n                    raise ModuleUpgradeRequiredError(msg)\n                else:\n                    raise ModuleNotFoundError(msg)\n\n        # handle Object columns separately (Arrow does not convert them correctly)\n        if Object in self.dtypes:\n            return self._to_pandas_with_object_columns(\n                use_pyarrow_extension_array=use_pyarrow_extension_array, **kwargs\n            )\n\n        return self._to_pandas_without_object_columns(\n            self, use_pyarrow_extension_array=use_pyarrow_extension_array, **kwargs\n        )\n\n    def _to_pandas_with_object_columns(\n        self,\n        *,\n        use_pyarrow_extension_array: bool,\n        **kwargs: Any,\n    ) -> pd.DataFrame:\n        # Find which columns are of type pl.Object, and which aren't:","sourceCodeStart":2604,"sourceCodeEnd":2640,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/dataframe/frame.py#L2604-L2640","documentation":"Raised as ModuleNotFoundError by DataFrame.to_pandas(use_pyarrow_extension_array=True) when pyarrow is not installed at all (polars' core is rust and does not require pyarrow). The extension-array path needs pyarrow both for ArrowDtype and for the actual zero-copy-ish conversion, so its complete absence is fatal for this option. The sibling branch (pyarrow present but <8.0) raises ModuleUpgradeRequiredError instead.","triggerScenarios":"`df.to_pandas(use_pyarrow_extension_array=True)` in an environment without pyarrow — e.g. slim docker images, polars-only installs where pyarrow was never added, or CI matrices that skip optional deps. The guard is `if not _PYARROW_AVAILABLE or parse_version(pa.__version__) < (8, 0)` with the ModuleNotFoundError taken in the else.","commonSituations":"Minimal container images that deliberately exclude pyarrow; new contributors running without requirements fully installed; optional-dependency install (`pip install polars`) rather than `polars[pyarrow]`-style extras in teams that rely on them.","solutions":["Install pyarrow: `pip install 'pyarrow>=8'`","If pyarrow is intentionally excluded, use the default conversion `df.to_pandas()`","Add pyarrow to the project's locked dependencies if you rely on extension-array output"],"exampleFix":"# before (no pyarrow installed)\npdf = df.to_pandas(use_pyarrow_extension_array=True)  # ModuleNotFoundError\n\n# after\n# pip install 'pyarrow>=8'\npdf = df.to_pandas(use_pyarrow_extension_array=True)","handlingStrategy":"validation","validationCode":"def pyarrow_available(min_version=(8, 0)) -> bool:\n    try:\n        import pyarrow as pa\n    except ImportError:\n        return False\n    return parse_version(pa.__version__) >= min_version\n\npdf = df.to_pandas(use_pyarrow_extension_array=True) if pyarrow_available() else df.to_pandas()","typeGuard":null,"tryCatchPattern":"try:\n    pdf = df.to_pandas(use_pyarrow_extension_array=True)\nexcept ModuleNotFoundError as e:\n    if 'pyarrow>=8.0.0' in str(e):\n        pdf = df.to_pandas()  # numpy/object dtypes instead of arrow-backed\n    else:\n        raise","preventionTips":["Add pyarrow to locked dependencies for any pipeline using extension arrays","Probe for optional imports at startup and disable the flag when absent","Dockerize builds with the full optional-dependency set to avoid slim-image surprises"],"tags":["pyarrow","missing-dependency","pandas","environment"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}