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
polars' `_import_optional_adbc_driver` wraps import of the adbc DBAPI module. If the import fails specifically because pyarrow is missing while adbc-driver-manager is < 1.6.0, polars raises ModuleUpgradeRequiredError telling you to upgrade adbc-driver-manager or install pyarrow. Other import errors are re-raised unchanged.
Solutions
- Upgrade adbc-driver-manager to >= 1.6.0: `pip install -U adbc-driver-manager` (plus the driver package, e.g. adbc-driver-postgresql).
- Install pyarrow: `pip install pyarrow`.
- Pin pyarrow alongside adbc-driver-manager in requirements if you must keep adbc < 1.6.0.
Example fix
// before (requirements.txt) adbc-driver-manager==1.2.0 // after adbc-driver-manager>=1.6.0 # or add: pyarrow
Defensive patterns
Strategy: validation
Validate before calling
import importlib.metadata as md
ver = tuple(int(x) for x in md.version("adbc-driver-manager").split(".")[:2])
if ver < (1, 6, 0):
try:
import pyarrow # noqa
except ImportError:
raise RuntimeError("install adbc-driver-manager>=1.6.0 or pyarrow") Try / catch
from polars.io.database import ModuleUpgradeRequiredError
try:
df = pl.read_database_uri(q, uri, engine="adbc")
except ModuleUpgradeRequiredError:
# surface actionable install instructions to the operator
raise Prevention
- Install the full adbc stack together: adbc-driver-manager + the specific driver package
- Prefer adbc-driver-manager>=1.6.0 so pyarrow becomes optional
- Run a smoke-test import of the adbc connection in CI
When it happens
Trigger: Any call path that opens an adbc connection: `read_database_uri(..., engine="adbc")`, `write_database(engine="adbc")`, or `_open_adbc_connection`, with adbc-driver-manager < 1.6.0 and pyarrow absent.
Common situations: Fresh environments where pyarrow was never installed and adbc-driver-manager is old; dependency resolvers that dropped pyarrow; upgrading code to capsule-interface-only polars while keeping old adbc pins.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- pyarrow is required for adbc-driver-manager <
- pyarrow is required for adbc-driver-manager <
- a more recent version of `fastexcel` is required for…
- a more recent version of `fastexcel` is required for…
- a more recent version of `fastexcel` is required for…
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/68db8fcc1946606f.
Report an issue: GitHub.
Appendix: 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 fe841f959e)