{"record":{"id":"9eedd85734b346e2","repo":"run-llama/llama_index","slug":"pandasqueryengine-has-been-moved-to-llama-index-e-9eedd8","errorCode":null,"errorMessage":"PandasQueryEngine has been moved to `llama-index-experimental`.\n`pip install llama-index-experimental`\n`from llama_index.experimental.query_engine import PandasQueryEngine`\nNote that the PandasQueryEngine allows for arbitrary code execution, \nand should be used in a secure environment.","messagePattern":"PandasQueryEngine has been moved to `llama-index-experimental`\\.\n`pip install llama-index-experimental`\n`from llama_index\\.experimental\\.query_engine import PandasQueryEngine`\nNote that the PandasQueryEngine allows for arbitrary code execution, \nand should be used in a secure environment\\.","errorType":"exception","errorClass":"DeprecationWarning","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/query_engine/pandas/pandas_query_engine.py","lineNumber":24,"sourceCode":"This tool is not recommended to be used in a production setting, and would\nrequire heavy sandboxing or virtual machines.\n\nDEPRECATED: Use `PandasQueryEngine` from `llama-index-experimental` instead.\n\n\"\"\"\n\nfrom typing import Any\n\n\nclass PandasQueryEngine:\n    \"\"\"\n    Pandas query engine.\n\n    DEPRECATED: Use `PandasQueryEngine` from `llama-index-experimental` instead.\n    \"\"\"\n\n    def __init__(self, *args: Any, **kwargs: Any) -> None:\n        raise DeprecationWarning(\n            \"PandasQueryEngine has been moved to `llama-index-experimental`.\\n\"\n            \"`pip install llama-index-experimental`\\n\"\n            \"`from llama_index.experimental.query_engine import PandasQueryEngine`\\n\"\n            \"Note that the PandasQueryEngine allows for arbitrary code execution, \\n\"\n            \"and should be used in a secure environment.\"\n        )\n\n\n# legacy\nNLPandasQueryEngine = PandasQueryEngine\nGPTNLPandasQueryEngine = PandasQueryEngine\n","sourceCodeStart":6,"sourceCodeEnd":36,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/query_engine/pandas/pandas_query_engine.py#L6-L36","documentation":"PandasQueryEngine was removed from llama-index-core and relocated to the llama-index-experimental package because it executes arbitrary LLM-generated Python code. The core module keeps only a stub class whose __init__ unconditionally raises a DeprecationWarning with migration instructions. Any instantiation (including the legacy aliases NLPandasQueryEngine / GPTNLPandasQueryEngine) fails immediately.","triggerScenarios":"Calling PandasQueryEngine(df, llm=...) (or NLPandasQueryEngine / GPTNLPandasQueryEngine) imported from llama_index.core.query_engine.pandas.pandas_query_engine. The stub accepts any *args/**kwargs and always raises in __init__.","commonSituations":"Upgrading llama-index-core to a version where the engine was extracted, or following old tutorials/docs that import from the core path; the import itself still succeeds, so the failure only appears at call time.","solutions":["pip install llama-index-experimental","Change the import to `from llama_index.experimental.query_engine import PandasQueryEngine` and remove the core-path import","Run it only in a sandboxed/secure environment (container, no secrets, restricted network) since it allows arbitrary code execution"],"exampleFix":"// before\nfrom llama_index.core.query_engine.pandas_query_engine import PandasQueryEngine\nqe = PandasQueryEngine(df=pandas_df, llm=llm)\n\n// after\n# pip install llama-index-experimental\nfrom llama_index.experimental.query_engine import PandasQueryEngine\nqe = PandasQueryEngine(df=pandas_df, llm=llm)","handlingStrategy":"validation","validationCode":"# guard before use\ntry:\n    from llama_index.experimental.query_engine import PandasQueryEngine  # correct path\n    HAS_EXPERIMENTAL = True\nexcept ImportError:\n    HAS_EXPERIMENTAL = False\n\nif not HAS_EXPERIMENTAL:\n    raise SystemExit(\"pip install llama-index-experimental\")","typeGuard":"def is_safe_query_engine(engine_cls: type) -> bool:\n    \"\"\"Ensure the engine is the experimental one, not the raising core stub.\"\"\"\n    return engine_cls.__module__.startswith(\"llama_index.experimental\")","tryCatchPattern":null,"preventionTips":["Pin llama-index-experimental in requirements alongside llama-index-core","Import from llama_index.experimental.query_engine, never the core pandas path","Run PandasQueryEngine workloads in a sandbox (container, no credentials) since it executes LLM-generated code"],"tags":["pandas","deprecation","install","code-execution"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}