{"record":{"id":"514435db2f2a7dfb","repo":"pandas-dev/pandas","slug":"numexpr-is-not-installed-or-an-unsupported-versi","errorCode":null,"errorMessage":"'numexpr' is not installed or an unsupported version. Cannot use engine='numexpr' for query/eval if 'numexpr' is not installed","messagePattern":"'numexpr' is not installed or an unsupported version\\. Cannot use engine='numexpr' for query/eval if 'numexpr' is not installed","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"pandas/core/computation/eval.py","lineNumber":75,"sourceCode":"        Engine name.\n    \"\"\"\n    from pandas.core.computation.check import NUMEXPR_INSTALLED\n    from pandas.core.computation.expressions import USE_NUMEXPR\n\n    if engine is None:\n        engine = \"numexpr\" if USE_NUMEXPR else \"python\"\n\n    if engine not in ENGINES:\n        valid_engines = list(ENGINES.keys())\n        raise KeyError(\n            f\"Invalid engine '{engine}' passed, valid engines are {valid_engines}\"\n        )\n\n    # TODO: validate this in a more general way (thinking of future engines\n    # that won't necessarily be import-able)\n    # Could potentially be done on engine instantiation\n    if engine == \"numexpr\" and not NUMEXPR_INSTALLED:\n        raise ImportError(\n            \"'numexpr' is not installed or an unsupported version. Cannot use \"\n            \"engine='numexpr' for query/eval if 'numexpr' is not installed\"\n        )\n\n    return engine\n\n\ndef _check_parser(parser: str) -> None:\n    \"\"\"\n    Make sure a valid parser is passed.\n\n    Parameters\n    ----------\n    parser : str\n\n    Raises\n    ------\n    KeyError","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/core/computation/eval.py#L57-L93","documentation":"Raised by _check_engine() when the user explicitly requests engine='numexpr' (or leaves engine=None and numexpr is the default) but the numexpr package is either not installed or is an unsupported version. Pandas uses numexpr as an optional accelerator for query/eval; when it is unavailable, the engine cannot be used and the call aborts before parsing. The check lives in _check_engine at eval.py:74, which imports NUMEXPR_INSTALLED from pandas.core.computation.check.","triggerScenarios":"Calling pd.eval(..., engine='numexpr') or df.query(..., engine='numexpr') in an environment where numexpr is not installed or is below the minimum supported version. Also triggered indirectly when engine=None (the default) and USE_NUMEXPR is True but NUMEXPR_INSTALLED is False — though normally the default path falls back to 'python' when numexpr is absent, so the explicit engine='numexpr' request is the dominant trigger.","commonSituations":"Fresh virtualenvs or slim Docker images where pandas was installed without the optional numexpr dependency; CI matrices that test with and without numexpr; environments where numexpr was pip-uninstalled or an incompatible wheel was installed for the Python version in use.","solutions":["Install or upgrade numexpr: pip install -U numexpr (verify with python -c 'import numexpr; print(numexpr.__version__)').","If you cannot install numexpr, pass engine='python' explicitly to pd.eval / df.query / df.eval to skip the accelerator.","If numexpr is installed but the error persists, confirm the Python interpreter pandas runs under is the same one where numexpr is installed (check sys.executable and pip show numexpr).","For containerized deployments, add numexpr to your requirements.txt or Dockerfile RUN pip install line."],"exampleFix":"// before\npd.eval('a + b', engine='numexpr')\n\n// after (option A — install)\n# pip install numexpr\npd.eval('a + b', engine='numexpr')\n\n// after (option B — fall back)\npd.eval('a + b', engine='python')","handlingStrategy":"validation","validationCode":"try:\n    import numexpr  # noqa: F401\n    _numexpr_ok = True\nexcept ImportError:\n    _numexpr_ok = False\n\nengine = 'numexpr' if _numexpr_ok else 'python'\npd.eval(expr, engine=engine)","typeGuard":null,"tryCatchPattern":"try:\n    result = pd.eval(expr, engine='numexpr')\nexcept ImportError:\n    result = pd.eval(expr, engine='python')","preventionTips":["Pin numexpr in your requirements.txt alongside pandas.","In containers, verify 'import numexpr' in the build step.","Default to engine=None so pandas auto-selects based on availability."],"tags":["pandas","eval","numexpr","dependency","engine"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}