pandas-dev/pandas · error · ImportError
Pandas requires version '{minimum_version}' or newer of '{pa
Error message
Pandas requires version '{minimum_version}' or newer of '{parent}' (version '{version}' currently installed). What it means
Raised by import_optional_dependency (compat/_optional.py:172-188) when an optional dependency IS installed but its version is older than the minimum pandas requires (min_version arg, or the VERSIONS dict default). With errors='raise' (default) it raises ImportError; errors='warn' emits a UserWarning and returns None; errors='ignore' silently returns None. Version comparison uses packaging.Version (via pandas.util.version.Version).
Source
Thrown at pandas/compat/_optional.py:188
else:
module_to_get = module
minimum_version = min_version if min_version is not None else VERSIONS.get(parent)
if minimum_version:
version = get_version(module_to_get)
if version and Version(version) < Version(minimum_version):
msg = (
f"Pandas requires version '{minimum_version}' or newer of '{parent}' "
f"(version '{version}' currently installed)."
)
if errors == "warn":
warnings.warn(
msg,
UserWarning,
stacklevel=find_stack_level(),
)
return None
elif errors == "raise":
raise ImportError(msg)
else:
return None
return module
View on GitHub (pinned to 71959b8cb9)
Solutions
- Upgrade the dependency to at least the stated minimum: pip install --upgrade '<pkg>>=<min>'.
- Check the installed version: python -c 'import <pkg>; print(<pkg>.__version__)'.
- If upgrading is blocked, downgrade pandas to a release that accepts your older dependency version.
- If you call import_optional_dependency directly, pass errors='warn' or 'ignore' to tolerate the old version (at your own risk).
Example fix
# before — openpyxl 2.x, pandas needs >= 3.0
pd.read_excel('f.xlsx')
# after
# shell: pip install --upgrade 'openpyxl>=3.0'
pd.read_excel('f.xlsx') Defensive patterns
Strategy: validation
Validate before calling
from packaging.version import Version
import importlib
mod = importlib.import_module(name)
installed = getattr(mod, '__version__', None)
if installed is None or Version(installed) < Version(minimum):
raise ImportError(f'{name}>={minimum} required, got {installed}') Try / catch
try:
import_optional_dependency(name, min_version=minimum)
except ImportError:
# too old — upgrade or fall back to older pandas
... Prevention
- Pin compatible lower bounds for optional deps in your requirements.
- Upgrade deps whenever you upgrade pandas.
- In CI, install the full pandas extras to surface version floors early.
When it happens
Trigger: pandas requires e.g. a minimum numpy/pyarrow/openpyxl/sqlalchemy version (declared in VERSIONS). import_optional_dependency compares Version(installed) < Version(minimum_version) and raises. Hitting it means the package imports but is too old for this pandas release.
Common situations: Upgrading pandas in an environment with stale optional deps (e.g. pandas 2.x needs newer numpy than 1.x); system Python with OS-packaged older libraries; pinning a dependency for compatibility with another tool that needs the old version.
Related errors
- Can't determine version for {module.__name__}
- `Import {install_name}` failed. {extra} Use pip, conda, or y
- Please upgrade numpy to >= {_min_numpy_ver} to use this pand
- pyarrow>={PYARROW_MIN_VERSION} is required for PyArrow backe
- Unable to import required dependency {_dependency}. Please s
AI-assisted analysis of pandas-dev/pandas@71959b8cb9 (2026-08-07).
Data as JSON: /api/errors/f65f38a930cbeb71.
Report an issue: GitHub.