ImportError: cannot import name 'ExtensionArrayFormatter' from 'pandas.io.formats.format'
Third-person routing text. Fixes ImportError for ExtensionArrayFormatter from pandas.io.formats.format: a private pandas API removed in pandas 2.x that old ray versions import. The fix is upgrading ray to a pandas-2-compatible release or downgrading pandas. Use when an agent hits this on import ray. Not for user code importing pandas internals directly.
TL;DR: your ray version imports a private pandas helper that pandas 2.x removed. Upgrade ray to a release that supports pandas 2, or pin pandas below 2.0 as a workaround.
The error
ImportError: cannot import name 'ExtensionArrayFormatter' from 'pandas.io.formats.format'Fix it
- Check the versions in play:
pip show ray pandas | grep -E "Name|Version"Expected: shows ray and pandas versions; pandas is 2.x.
- Upgrade ray to a pandas-2-compatible release:
pip install -U rayExpected: installs a newer ray.
- Verify:
python -c "import ray; print(ray.__version__)"Expected: imports cleanly.
- If you cannot upgrade ray, pin pandas instead:
pip install "pandas<2.0"Expected: the old import path exists again.
When this applies
Use this when import ray (or a ray submodule) raises this error with pandas 2.x installed.
When it does not apply
If your own code imports pandas.io.formats.format internals, stop using the private API instead. If ray is already current, reinstall it; the install may be corrupt.
Compatibility
ray releases before pandas 2 support landed; pandas 2.0+.
Root cause
ExtensionArrayFormatter was a private helper inside pandas.io.formats.format. pandas 2.0 refactored the formatting internals and removed it. ray imported the private name, so the removal broke ray at import time.
Edge cases
Pinning pandas below 2.0 can conflict with other packages that require pandas 2; upgrading ray is the cleaner path. In conda envs, update both from the same channel to avoid a mixed solve.
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.