pandas-dev/pandas · critical · ImportError

pyarrow>={PYARROW_MIN_VERSION} is required for PyArrow backe

Error message

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

What it means

Raised by ArrowExtensionArray.__init__ when the HAS_PYARROW flag is False, i.e. pyarrow is not installed or is older than PYARROW_MIN_VERSION (currently 13.0.0 per pandas.compat.pyarrow). Any operation that materializes a pyarrow-backed extension array (e.g. pd.array(..., dtype='int64[pyarrow]')) routes through this constructor. It is an ImportError, not a ValueError, signalling a missing optional dependency.

Source

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

    >>> 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 71959b8cb9)

Solutions

  1. Install a compatible pyarrow: `pip install 'pyarrow>=13.0.0'`.
  2. If pyarrow is installed but old, upgrade it: `pip install -U pyarrow`.
  3. Verify in-process: `import pyarrow as pa; print(pa.__version__)`.
  4. If you cannot install pyarrow, avoid pyarrow dtypes (drop dtype='...[pyarrow]' and convert_dtypes(dtype_backend='pyarrow')).

Example fix

# before
import pandas as pd
s = pd.array([1, 2, 3], dtype='int64[pyarrow]')  # ImportError if pyarrow missing
# after - ensure dependency is present
# shell: pip install 'pyarrow>=13.0.0'
import pyarrow as pa  # guard
s = pd.array([1, 2, 3], dtype='int64[pyarrow]')
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util, packaging.version

def pyarrow_ok(min_version='13.0.0') -> bool:
    spec = importlib.util.find_spec('pyarrow')
    if spec is None:
        return False
    import pyarrow as pa
    return packaging.version.parse(pa.__version__) >= packaging.version.parse(min_version)

if not pyarrow_ok():
    raise SystemExit('pyarrow>=13.0.0 required; pip install "pyarrow>=13.0.0"')

s = pd.array([1,2,3], dtype='int64[pyarrow]')

Type guard

def has_pyarrow_backend() -> bool:
    try:
        import pyarrow  # noqa: F401
        import pandas  # noqa: F401
        from pandas.compat.pyarrow import PYARROW_MIN_VERSION
        import pyarrow as pa
        from packaging.version import parse
        return parse(pa.__version__) >= parse(PYARROW_MIN_VERSION)
    except ImportError:
        return False

Try / catch

try:
    s = pd.array(data, dtype='int64[pyarrow]')
except ImportError as e:
    if 'pyarrow' in str(e):
        # fall back to numpy-backed dtype
        s = pd.array(data, dtype='int64')
    else:
        raise

Prevention

When it happens

Trigger: Constructing any ArrowExtensionArray or ArrowDtype-backed Series/array without pyarrow installed: `pd.array([1,2], dtype='int64[pyarrow]')`, `pd.Series([...], dtype='string[pyarrow]')`, `df.convert_dtypes(dtype_backend='pyarrow')`, reading a pyarrow-backed frame.

Common situations: Fresh environment without pyarrow, CI image missing the optional dep, downgrading/pinning pyarrow below 13.0.0, or slim Docker images that exclude optional extras. Also triggered by `pip install pandas` without `[arrow]`/pyarrow.

Related errors


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