{"record":{"id":"aab9bc11754a9750","repo":"pandas-dev/pandas","slug":"pyarrow-pyarrow-min-version-is-required-for-pya-aab9bc","errorCode":null,"errorMessage":"pyarrow>={PYARROW_MIN_VERSION} is required for PyArrow backed ArrowExtensionArray.","messagePattern":"pyarrow>=(.+?) is required for PyArrow backed ArrowExtensionArray\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"pandas/core/arrays/string_arrow.py","lineNumber":76,"sourceCode":"        AxisInt,\n        Dtype,\n        NpDtype,\n        Scalar,\n        npt,\n    )\n\n    from pandas.core.dtypes.dtypes import ExtensionDtype\n\n    from pandas import Series\n\n\ndef _check_pyarrow_available() -> None:\n    if not HAS_PYARROW:\n        msg = (\n            f\"pyarrow>={PYARROW_MIN_VERSION} is required for PyArrow \"\n            \"backed ArrowExtensionArray.\"\n        )\n        raise ImportError(msg)\n\n\ndef _is_string_view(typ):\n    return not pa_version_under16p0 and pa.types.is_string_view(typ)\n\n\n# Matches a `\\Z` that is an end-of-string assertion rather than an escaped\n# backslash followed by a literal \"Z\"; the captured group keeps any preceding\n# pairs of escaped backslashes intact.\n_unescaped_end_anchor = re.compile(r\"(?<!\\\\)((?:\\\\\\\\)*)\\\\Z\")\n\n\n# TODO: Inherit directly from BaseStringArrayMethods. Currently we inherit from\n# ObjectStringArrayMixin because we want to have the object-dtype based methods as\n# fallback for the ones that pyarrow doesn't yet support\n\n\n@set_module(\"pandas.arrays\")","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/core/arrays/string_arrow.py#L58-L94","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install or upgrade pyarrow: pip install -U 'pyarrow>=PYARROW_MIN_VERSION'.","Fall back to 'string' (python-backed) or object dtype if pyarrow is unavailable.","Pin pyarrow to a version at or above pandas' required minimum in requirements.","Run python -c 'import pyarrow; print(pyarrow.__version__)' to verify availability."],"exampleFix":"// before\npd.array(['a','b'], dtype='string[pyarrow]')  # ImportError without pyarrow\n// after\npip install -U pyarrow\npd.array(['a','b'], dtype='string[pyarrow]')\n# or fallback\npd.array(['a','b'], dtype='string')","handlingStrategy":"try-catch","validationCode":"def has_pyarrow():\n    try:\n        import pyarrow\n        from pandas.compat import PYARROW_MIN_VERSION\n        from packaging.version import Version\n        return Version(pyarrow.__version__) >= Version(PYARROW_MIN_VERSION)\n    except ImportError:\n        return False","typeGuard":"def pyarrow_available() -> bool:\n    import importlib.util\n    return importlib.util.find_spec('pyarrow') is not None","tryCatchPattern":"try:\n    pd.array(data, dtype='string[pyarrow]')\nexcept ImportError:\n    pd.array(data, dtype='string')","preventionTips":["Declare pyarrow in requirements when using string[pyarrow].","Pin pyarrow to a version at or above pandas' minimum.","Provide a fallback dtype for environments without pyarrow."],"tags":["pandas","pyarrow","importerror","dependency","environment"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}