pola-rs/polars · error · ModuleUpgradeRequiredError

pyarrow is required for adbc-driver-manager < 1.6.0, found {

Error message

pyarrow is required for adbc-driver-manager < 1.6.0, found {adbc_str_version}.
Either upgrade `adbc-driver-manager` (suggested) or install `pyarrow`

What it means

Raised while importing a backend driver's dbapi module when the import fails with the backend's own 'PyArrow is required for the DBAPI-compatible interface' message. ADBC backend dbapi modules older than 1.6.0 hard-require PyArrow; polars intercepts that ImportError and re-raises it as ModuleUpgradeRequiredError with actionable guidance.

Source

Thrown at py-polars/src/polars/io/database/_utils.py:174

    )
    if not dbapi_submodule:
        return adbc_driver
    # Importing the dbapi without pyarrow before adbc_driver_manager 1.6.0
    # raises ImportError: PyArrow is required for the DBAPI-compatible interface
    # Use importlib.import_module because Polars' import_optional clobbers this error
    try:
        adbc_driver_dbapi = import_module(f"{module_name}.dbapi")
    except ImportError as e:
        if "PyArrow is required for the DBAPI-compatible interface" in (str(e)):
            adbc_driver_manager = import_optional("adbc_driver_manager")
            adbc_str_version = getattr(adbc_driver_manager, "__version__", "0.0")

            msg = (
                "pyarrow is required for adbc-driver-manager < 1.6.0, found "
                f"{adbc_str_version}.\nEither upgrade `adbc-driver-manager` (suggested) or "
                "install `pyarrow`"
            )
            raise ModuleUpgradeRequiredError(msg) from None
        # if the error message was something different, re-raise it
        raise
    else:
        return adbc_driver_dbapi


def _open_adbc_connection(connection_uri: str) -> Any:
    driver_name = _get_adbc_driver_name_from_uri(connection_uri)
    module_name = _get_adbc_module_name_from_uri(connection_uri)
    adbc_driver = _import_optional_adbc_driver(module_name)

    # some backends require the driver name to be stripped from the URI
    if driver_name in ("duckdb", "snowflake", "sqlite"):
        connection_uri = re.sub(f"^{driver_name}:/{{,3}}", "", connection_uri)

    return adbc_driver.connect(connection_uri)

View on GitHub (pinned to df599052da)

Solutions

  1. Install pyarrow: pip install pyarrow
  2. Or upgrade the whole adbc stack to >= 1.6.0: pip install -U 'adbc-driver-manager>=1.6.0' plus matching backend drivers, whose dbapi no longer hard-requires pyarrow
  3. Check pip show adbc-driver-manager and each adbc-driver-* package to find the stale one

Example fix

# before
pip install adbc-driver-sqlite  # no pyarrow, driver dbapi needs it

# after
pip install pyarrow
# or
pip install -U 'adbc-driver-manager>=1.6.0' adbc-driver-sqlite
Defensive patterns

Strategy: validation

Validate before calling

try:
    import pyarrow  # noqa: F401
    HAS_PA = True
except ImportError:
    HAS_PA = False

if not HAS_PA:
    from importlib.metadata import version
    from packaging.version import parse
    assert parse(version("adbc_driver_manager")) >= (1, 6, 0), "install pyarrow or upgrade adbc stack"

Prevention

When it happens

Trigger: pl.read_database_uri(..., engine='adbc') for any backend (e.g. adbc-driver-sqlite, adbc-driver-postgresql) where the installed driver's dbapi module needs PyArrow and pyarrow is absent.

Common situations: Slipstream installs of adbc drivers pulled in without pyarrow; slim Docker images; version drift where adbc-driver-manager is new but an individual backend driver is old.

Related errors


AI-assisted analysis of pola-rs/polars@df599052da (2026-08-16). Data as JSON: /api/errors/68db8fcc1946606f. Report an issue: GitHub.