pandas-dev/pandas · critical · ImportError
Please upgrade numpy to >=
Error message
Please upgrade numpy to >= {_min_numpy_ver} to use this pandas version.
Your numpy version is {_np_version}. What it means
Raised at pandas import time (in pandas.compat.numpy) when the installed numpy is older than the floor pandas was built against (`_min_numpy_ver`, currently '2.0.2'). This is a hard import-time gate: pandas will not finish importing, so any `import pandas` fails before user code runs. The message states both the required minimum and the detected version.
Solutions
- Upgrade numpy: `pip install -U 'numpy>=2.0.2'` or `conda install 'numpy>=2.0.2'`.
- If you must keep the old numpy, install an older pandas whose `_min_numpy_ver` is satisfied (e.g. pandas 2.2.x).
- Resolve dependency conflicts with `pip check` and a clean venv.
Example fix
// before pip install numpy==1.26 import pandas as pd # fails // after pip install 'numpy>=2.0.2' import pandas as pd
Defensive patterns
Strategy: validation
Validate before calling
import numpy as np
from packaging.version import Version
assert Version(np.__version__) >= Version('2.0.2') Prevention
- Pin numpy>=2.0.2 alongside pandas in requirements files.
- Use a clean venv when numpy version conflicts arise.
- Run `pip check` after dependency changes.
When it happens
Trigger: `import pandas as pd` in an environment where numpy is pinned below 2.0.2 (e.g. a legacy environment with numpy 1.26); CI matrix accidentally testing old numpy with new pandas.
Common situations: Pinning numpy for another library (e.g. an old tensorflow) below pandas' floor; fresh conda env that resolved an old numpy; mixed pip+conda installs.
Related errors
- Pandas requires version
- Can't determine version for
- Cannot apply ufunc to mixed DataFrame and Series inputs.
- Cannot modify read-only array
- expected dimension <= 1 data
AI-assisted analysis of pandas-dev/pandas@3b7651241d (2026-08-11).
Data as JSON: /api/errors/9492f898b3f48768.
Report an issue: GitHub.
Appendix: source
Thrown at pandas/compat/numpy/__init__.py:19
"""support numpy compatibility across versions"""
import numpy as np
from pandas.util.version import Version
# numpy versioning
_np_version = np.__version__
_nlv = Version(_np_version)
np_version_gt2_2 = _nlv >= Version("2.2.0")
np_version_gt2_3 = _nlv >= Version("2.3.0")
np_version_gt2_5 = _nlv >= Version("2.5.0")
np_version_gt2_6 = _nlv >= Version("2.6.0.dev0")
is_numpy_dev = _nlv.dev is not None
_min_numpy_ver = "2.0.2"
if _nlv < Version(_min_numpy_ver):
raise ImportError(
f"Please upgrade numpy to >= {_min_numpy_ver} to use this pandas version.\n"
f"Your numpy version is {_np_version}."
)
__all__ = [
"_np_version",
"is_numpy_dev",
]
View on GitHub (pinned to 3b7651241d)