ImportError: cannot import name 'POLARS_STORAGE_CONFIG_KEYS' from 'polars.io.cloud._utils'
Third-person routing text. Fixes polars failing with ImportError for POLARS_STORAGE_CONFIG_KEYS from polars.io.cloud._utils: a mixed or partial polars install. Clean-reinstall polars from a single version. Use when an agent hits this importing polars. Not for user code.
TL;DR: your polars install is a mix of versions from a partial upgrade. Uninstall polars fully, delete leftovers, and install one clean version.
The error
ImportError: cannot import name 'POLARS_STORAGE_CONFIG_KEYS' from 'polars.io.cloud._utils'Fix it
- Uninstall polars:
pip uninstall -y polarsExpected: reports removal.
- Check site-packages for a leftover polars folder and delete it by hand.
- Install fresh:
pip install polarsExpected: install completes.
- Verify:
python -c "import polars; print(polars.__version__)"Expected: prints the version, no error.
When this applies
Use this when import polars itself raises the POLARSSTORAGECONFIG_KEYS error, which signals mixed install files.
When it does not apply
If your own code imports from polars.io.cloud._utils, stop; it is a private module. If the error is a different missing name, check the polars version first.
Compatibility
Any polars version; this is an install-hygiene issue.
Root cause
polars.io.cloud._utils is a private module whose contents change between releases. A partial upgrade (or pip plus conda both installing polars) leaves old and new files side by side, and the mismatched modules cannot import each other's names.
Edge cases
polars ships a compiled binary per version; mixing the python files of one version with the binary of another produces exactly this class of error. In docker, pin the polars version so rebuilds stay consistent.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.