pandas-dev/pandas · error · ImportError

pyarrow>= is required for PyArrow backed…

Error message

pyarrow>={PYARROW_MIN_VERSION} is required for PyArrow backed ArrowExtensionArray.

What it means

`ImportError` from `ArrowExtensionArray.__init__` when pyarrow is not installed (or is older than `PYARROW_MIN_VERSION`, currently '13.0.0'). The `HAS_PYARROW` flag from `pandas.compat` is False, so constructing an `ArrowExtensionArray` directly — or any operation that needs to materialize one (e.g. `dtype=pd.ArrowDtype(...)`, `convert_dtypes(dtype_backend='pyarrow')`, reading parquet) — refuses to proceed rather than failing later inside pyarrow.

Solutions

  1. Install pyarrow at or above the minimum: `pip install 'pyarrow>=13.0.0'` (or `pip install pandas[pyarrow]`).
  2. Pin pyarrow in your requirements to a version pandas supports.
  3. If you cannot install pyarrow, avoid Arrow-backed dtypes: use numpy/object/string backends and drop `dtype_backend='pyarrow'` / `pd.ArrowDtype(...)`.

Example fix

// before
$ pip install pandas
>>> df.convert_dtypes(dtype_backend='pyarrow')   # ImportError

// after
$ pip install 'pyarrow>=13.0.0'
>>> df.convert_dtypes(dtype_backend='pyarrow')
Defensive patterns

Strategy: validation

Validate before calling

from pandas.compat import HAS_PYARROW
if not HAS_PYARROW:
    raise ImportError("Install pyarrow>=13.0.0: pip install 'pyarrow>=13.0.0'")
ArrowExtensionArray(pa.array(data))

Type guard

def pyarrow_available() -> bool:
    from pandas.compat import HAS_PYARROW
    return HAS_PYARROW

Try / catch

try:
    arr = ArrowExtensionArray(pa.array(data))
except ImportError as e:
    if 'pyarrow' in str(e):
        raise SystemExit('This feature needs pyarrow. pip install pandas[pyarrow]') from e
    raise

Prevention

When it happens

Trigger: `pd.array(data, dtype=pd.ArrowDtype(pa.int64()))` with pyarrow missing; `df.convert_dtypes(dtype_backend='pyarrow')` without pyarrow; `pd.read_parquet(...)` paths that build an ArrowExtensionArray; explicitly `ArrowExtensionArray(pa.array(...))`.

Common situations: Deploying to a slimmed-down environment that installed pandas without the `pyarrow` extra; CI matrix that omits pyarrow; version drift where the installed pyarrow is below pandas' minimum.

Related errors


AI-assisted analysis of pandas-dev/pandas@3b7651241d (2026-08-11). Data as JSON: /api/errors/46e474fb6e6925ac. Report an issue: GitHub.

Appendix: source

Thrown at pandas/core/arrays/arrow/array.py:405

    >>> pd.array([1, 1, None], dtype="int64[pyarrow]")
    <ArrowExtensionArray>
    [1, 1, <NA>]
    Length: 3, dtype: int64[pyarrow]
    """  # noqa: E501 (http link too long)

    _pa_array: pa.ChunkedArray
    _dtype: ArrowDtype
    # results from calls to methods decorated with cache_readonly get added here
    _cache: dict[str, pa.ChunkedArray]

    def __init__(self, values: pa.Array | pa.ChunkedArray) -> None:
        if not HAS_PYARROW:
            msg = (
                f"pyarrow>={PYARROW_MIN_VERSION} is required for PyArrow "
                "backed ArrowExtensionArray."
            )
            raise ImportError(msg)
        if isinstance(values, pa.Array):
            self._pa_array = pa.chunked_array([values])
        elif isinstance(values, pa.ChunkedArray):
            self._pa_array = values
        else:
            raise ValueError(
                f"Unsupported type '{type(values)}' for ArrowExtensionArray"
            )
        self._dtype = ArrowDtype(self._pa_array.type)
        self._cache = {}

    @classmethod
    def _from_sequence(
        cls, scalars, *, dtype: Dtype | None = None, copy: bool = False
    ) -> Self:
        """
        Construct a new ExtensionArray from a sequence of scalars.
        """

View on GitHub (pinned to 3b7651241d)