{"record":{"id":"f65f38a930cbeb71","repo":"pandas-dev/pandas","slug":"pandas-requires-version-minimum-version-or-new","errorCode":null,"errorMessage":"Pandas requires version '{minimum_version}' or newer of '{parent}' (version '{version}' currently installed).","messagePattern":"Pandas requires version '(.+?)' or newer of '(.+?)' \\(version '(.+?)' currently installed\\)\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"pandas/compat/_optional.py","lineNumber":188,"sourceCode":"    else:\n        module_to_get = module\n    minimum_version = min_version if min_version is not None else VERSIONS.get(parent)\n    if minimum_version:\n        version = get_version(module_to_get)\n        if version and Version(version) < Version(minimum_version):\n            msg = (\n                f\"Pandas requires version '{minimum_version}' or newer of '{parent}' \"\n                f\"(version '{version}' currently installed).\"\n            )\n            if errors == \"warn\":\n                warnings.warn(\n                    msg,\n                    UserWarning,\n                    stacklevel=find_stack_level(),\n                )\n                return None\n            elif errors == \"raise\":\n                raise ImportError(msg)\n            else:\n                return None\n\n    return module\n","sourceCodeStart":170,"sourceCodeEnd":193,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/compat/_optional.py#L170-L193","documentation":"Raised by `import_optional_dependency` when an optional dependency is importable but its version is older than the minimum pandas requires (from the VERSIONS table or an explicit `min_version` argument) and `errors='raise'`. The message shows the required floor, the parent package, and the detected version. With `errors='warn'` the same condition emits a UserWarning and returns None instead.","triggerScenarios":"`pd.read_excel` with openpyxl < the listed minimum; `to_sql` with an old SQLAlchemy; passing `min_version='2.0'` to `import_optional_dependency` with an older installed version.","commonSituations":"Long-lived conda environments with stale optional deps; Docker images pinned to old versions; partial upgrades where pandas was bumped but deps were not.","solutions":["Upgrade the named package: `pip install -U <parent>`.","Verify the installed version: `python -c 'import <parent>; print(<parent>.__version__)'`.","If you cannot upgrade, downgrade pandas to a release whose VERSIONS table accepts your dependency version."],"exampleFix":"// before\npip install openpyxl==1.8  # too old\n\n// after\npip install -U openpyxl","handlingStrategy":"validation","validationCode":"from packaging.version import Version\nimport <parent>\nassert Version(<parent>.__version__) >= Version(minimum)","typeGuard":null,"tryCatchPattern":"try:\n    import_optional_dependency(name, min_version='2.0')\nexcept ImportError:\n    # instruct user to upgrade; degrade\n    pass","preventionTips":["Pin optional deps to >= the pandas VERSIONS table in your requirements.","Run `pip check` in CI to catch stale combinations."],"tags":["dependencies","version-mismatch","optional-deps"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}