{"record":{"id":"9492f898b3f48768","repo":"pandas-dev/pandas","slug":"please-upgrade-numpy-to-min-numpy-ver-to-use","errorCode":null,"errorMessage":"Please upgrade numpy to >= {_min_numpy_ver} to use this pandas version.\nYour numpy version is {_np_version}.","messagePattern":"Please upgrade numpy to >= (.+?) to use this pandas version\\.\nYour numpy version is (.+?)\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"critical","filePath":"pandas/compat/numpy/__init__.py","lineNumber":22,"sourceCode":"\nimport numpy as np\n\nfrom pandas.util.version import Version\n\n# numpy versioning\n_np_version = np.__version__\n_nlv = Version(_np_version)\nnp_version_gt2 = _nlv >= Version(\"2.0.0\")\nnp_version_gt2_2 = _nlv >= Version(\"2.2.0\")\nnp_version_gt2_3 = _nlv >= Version(\"2.3.0\")\nnp_version_gt2_5 = _nlv >= Version(\"2.5.0\")\nnp_version_gt2_6 = _nlv >= Version(\"2.6.0.dev0\")\nis_numpy_dev = _nlv.dev is not None\n_min_numpy_ver = \"1.26.0\"\n\n\nif _nlv < Version(_min_numpy_ver):\n    raise ImportError(\n        f\"Please upgrade numpy to >= {_min_numpy_ver} to use this pandas version.\\n\"\n        f\"Your numpy version is {_np_version}.\"\n    )\n\n\nnp_long: type\nnp_ulong: type\n\nif np_version_gt2:\n    try:\n        with warnings.catch_warnings():\n            warnings.filterwarnings(\n                \"ignore\",\n                r\".*In the future `np\\.long` will be defined as.*\",\n                FutureWarning,\n            )\n            np_long = np.long\n            np_ulong = np.ulong","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/pandas-dev/pandas/blob/71959b8cb9b2459c16e14b34f28b178ccfe14735/pandas/compat/numpy/__init__.py#L4-L40","documentation":"Raised at import time of pandas itself (compat/numpy/__init__.py:21-25) when the installed numpy is older than _min_numpy_ver ('1.26.0' at line 18). Because this module is imported during pandas startup, the ImportError surfaces as soon as you `import pandas`, before any pandas API is usable. The check uses Version(np.__version__) < Version('1.26.0').","triggerScenarios":"`import pandas` in an environment whose numpy is < 1.26.0. This is a hard floor: even numpy 1.25.x fails. Common after installing a newer pandas into an env that still has an older numpy, or on a system Python with an ancient numpy.","commonSituations":"Upgrading pandas via pip without --upgrade numpy; conda env mixing channels; a Docker base image with old numpy; a CI matrix that didn't bump numpy alongside pandas.","solutions":["Upgrade numpy: pip install --upgrade 'numpy>=1.26.0'.","Verify with: python -c 'import numpy; print(numpy.__version__)' and ensure >= 1.26.0.","If you cannot upgrade numpy, install a pandas release compatible with your numpy (older pandas releases had lower numpy floors).","Recreate the venv/conda env cleanly so numpy and pandas resolve together."],"exampleFix":"# before — ImportError on `import pandas` due to numpy 1.24\nimport pandas  # fails\n\n# after\n# shell: pip install --upgrade 'numpy>=1.26.0'\nimport pandas  # ok","handlingStrategy":"validation","validationCode":"import numpy as np\nfrom packaging.version import Version\nif Version(np.__version__) < Version('1.26.0'):\n    raise SystemExit(f'numpy>=1.26.0 required, got {np.__version__}')","typeGuard":null,"tryCatchPattern":"try:\n    import pandas\nexcept ImportError as e:\n    if 'Please upgrade numpy' in str(e):\n        # instruct user/environment to upgrade numpy\n        ...\n    raise","preventionTips":["Keep numpy and pandas versions in sync; upgrade both together.","Recreate virtualenvs cleanly after a pandas major upgrade.","Verify numpy version right after installing pandas: python -c 'import numpy;print(numpy.__version__)'."],"tags":["compat","numpy","version","import","importerror","startup"],"analyzedSha":"71959b8cb9b2459c16e14b34f28b178ccfe14735","analyzedAt":"2026-08-07T01:30:20.476Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}