{"record":{"id":"903565625b26cf3a","repo":"pola-rs/polars","slug":"deltalake-is-not-installed-please-run-pip-instal","errorCode":null,"errorMessage":"deltalake is not installed\n\nPlease run: pip install deltalake","messagePattern":"deltalake is not installed\n\nPlease run: pip install deltalake","errorType":"exception","errorClass":"ModuleNotFoundError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/delta/_utils.py","lineNumber":95,"sourceCode":"            version=version,\n            storage_options=storage_options,\n            **delta_table_options,\n        )\n    else:\n        dl_tbl = deltalake.DeltaTable(\n            table_path,\n            storage_options=storage_options,\n            **delta_table_options,\n        )\n        dl_tbl.load_as_version(version)\n\n    return dl_tbl\n\n\ndef _check_if_delta_available() -> None:\n    if not _DELTALAKE_AVAILABLE:\n        msg = \"deltalake is not installed\\n\\nPlease run: pip install deltalake\"\n        raise ModuleNotFoundError(msg)\n\n\ndef _check_for_unsupported_types(dtypes: list[DataType]) -> None:\n    schema_dtypes = unpack_dtypes(*dtypes)\n    unsupported_types = {Time, Null}\n    # Note that this overlap check does NOT work correctly for Categorical, so\n    # if Categorical is added back to unsupported_types a different check will\n    # need to be used.\n\n    if overlap := schema_dtypes & unsupported_types:\n        msg = f\"dataframe contains unsupported data types: {overlap!r}\"\n        raise TypeError(msg)\n\n\ndef _extract_table_statistics_from_delta_add_actions(\n    add_actions_df: DataFrame,\n    *,\n    filter_columns: list[str],","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/delta/_utils.py#L77-L113","documentation":"write_delta, sink_delta, and delta scan paths require the optional deltalake package. _check_if_delta_available raises ModuleNotFoundError with an install hint when the import flag _DELTALAKE_AVAILABLE is false.","triggerScenarios":"Calling pl.write_delta / pl.sink_delta / pl.scan_delta (or read_delta) in an environment where deltalake was never pip-installed.","commonSituations":"Fresh environments, Docker images, or CI where polars was installed without the delta extra.","solutions":["pip install deltalake","pip install 'polars[delta]' to pull the extra","Verify with python -c 'import deltalake' that the package is importable in the active interpreter"],"exampleFix":"// before\npip install polars\n// after\npip install 'polars[delta]'","handlingStrategy":"validation","validationCode":"import importlib.util\nif importlib.util.find_spec('deltalake') is None:\n    raise RuntimeError('deltalake not installed: pip install deltalake')","typeGuard":null,"tryCatchPattern":"try:\n    pl.write_delta(df, uri)\nexcept ModuleNotFoundError as e:\n    if 'deltalake' in str(e):\n        raise SystemExit(\"Install: pip install 'polars[delta]'\")","preventionTips":["Declare deltalake (or polars[delta]) in project dependencies","Smoke-test imports in CI before running delta jobs","Use extras when installing polars in Docker images"],"tags":["python","polars","delta-lake","optional-dependency","install"],"backgroundTag":"missing-optional-dependency","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}