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

Importing or instantiating ArrowExtensionArray-backed types raises ImportError when pyarrow is not installed or below PYARROW_MIN_VERSION. The check is performed lazily by _check_pyarrow_available so that the rest of pandas works without pyarrow, but any string[pyarrow], ArrowDtype, or pyarrow-anchored constructor will trigger it.

Solutions

  1. Install or upgrade pyarrow: pip install -U 'pyarrow>=PYARROW_MIN_VERSION'.
  2. Fall back to 'string' (python-backed) or object dtype if pyarrow is unavailable.
  3. Pin pyarrow to a version at or above pandas' required minimum in requirements.
  4. Run python -c 'import pyarrow; print(pyarrow.__version__)' to verify availability.

Example fix

// before
pd.array(['a','b'], dtype='string[pyarrow]')  # ImportError without pyarrow
// after
pip install -U pyarrow
pd.array(['a','b'], dtype='string[pyarrow]')
# or fallback
pd.array(['a','b'], dtype='string')
Defensive patterns

Strategy: try-catch

Validate before calling

def has_pyarrow():
    try:
        import pyarrow
        from pandas.compat import PYARROW_MIN_VERSION
        from packaging.version import Version
        return Version(pyarrow.__version__) >= Version(PYARROW_MIN_VERSION)
    except ImportError:
        return False

Type guard

def pyarrow_available() -> bool:
    import importlib.util
    return importlib.util.find_spec('pyarrow') is not None

Try / catch

try:
    pd.array(data, dtype='string[pyarrow]')
except ImportError:
    pd.array(data, dtype='string')

Prevention

When it happens

Trigger: pd.array(data, dtype='string[pyarrow]'); pd.ArrowDtype(pa...); pd.read_csv(..., dtype_backend='pyarrow'); any operation that constructs an ArrowExtensionArray in an environment without pyarrow or with an outdated version.

Common situations: Deploying to a slimmed image that installs pandas but not pyarrow; CI pinning pyarrow below the minimum; relying on string[pyarrow] default storage without declaring the dependency.

Related errors


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

Appendix: source

Thrown at pandas/core/arrays/string_arrow.py:76

        AxisInt,
        Dtype,
        NpDtype,
        Scalar,
        npt,
    )

    from pandas.core.dtypes.dtypes import ExtensionDtype

    from pandas import Series


def _check_pyarrow_available() -> None:
    if not HAS_PYARROW:
        msg = (
            f"pyarrow>={PYARROW_MIN_VERSION} is required for PyArrow "
            "backed ArrowExtensionArray."
        )
        raise ImportError(msg)


def _is_string_view(typ):
    return not pa_version_under16p0 and pa.types.is_string_view(typ)


# Matches a `\Z` that is an end-of-string assertion rather than an escaped
# backslash followed by a literal "Z"; the captured group keeps any preceding
# pairs of escaped backslashes intact.
_unescaped_end_anchor = re.compile(r"(?<!\\)((?:\\\\)*)\\Z")


# TODO: Inherit directly from BaseStringArrayMethods. Currently we inherit from
# ObjectStringArrayMixin because we want to have the object-dtype based methods as
# fallback for the ones that pyarrow doesn't yet support


@set_module("pandas.arrays")

View on GitHub (pinned to 3b7651241d)