run-llama/llama_index · warning · DeprecationWarning
PandasQueryEngine has been moved to `llama-index-experimenta
Error message
PandasQueryEngine has been moved to `llama-index-experimental`. `pip install llama-index-experimental` `from llama_index.experimental.query_engine import PandasQueryEngine` Note that the PandasQueryEngine allows for arbitrary code execution, and should be used in a secure environment.
What it means
PandasIndex (and GPTPandasIndex) were moved out of llama-index-core into llama-index-experimental because PandasQueryEngine generates and executes arbitrary pandas code. The stub class raises DeprecationWarning in __init__ so old imports keep working but instantiation fails with instructions for the new package.
Source
Thrown at llama-index-core/llama_index/core/indices/struct_store/pandas.py:16
"""
Pandas csv structured store.
DEPRECATED: Please use :class:`PandasQueryEngine` in `llama-index-experimental` instead.
"""
from typing import Any
class PandasIndex:
def __init__(
self,
*args: Any,
**kwargs: Any,
) -> None:
raise DeprecationWarning(
"PandasQueryEngine has been moved to `llama-index-experimental`.\n"
"`pip install llama-index-experimental`\n"
"`from llama_index.experimental.query_engine import PandasQueryEngine`\n"
"Note that the PandasQueryEngine allows for arbitrary code execution, \n"
"and should be used in a secure environment."
)
# Legacy
GPTPandasIndex = PandasIndex
View on GitHub (pinned to afd0fef371)
Solutions
- pip install llama-index-experimental and change the import to from llama_index.experimental.query_engine import PandasQueryEngine
- Use PandasQueryEngine(df, ...) instead of building a PandasIndex directly
- Run it only in a sandboxed/secure environment — it executes LLM-generated code by design
Example fix
# before from llama_index.core.indices.struct_store.pandas import PandasIndex, GPTPandasIndex index = PandasIndex(df=df) # raises DeprecationWarning # after pip install llama-index-experimental from llama_index.experimental.query_engine import PandasQueryEngine query_engine = PandasQueryEngine(df=df)
Defensive patterns
Strategy: fallback
Validate before calling
try:
from llama_index.experimental.query_engine import PandasQueryEngine
HAS_EXPERIMENTAL = True
except ImportError:
HAS_EXPERIMENTAL = False
if not HAS_EXPERIMENTAL:
raise RuntimeError('pip install llama-index-experimental for PandasQueryEngine') Type guard
def pandas_engine_available() -> bool:
try:
from llama_index.experimental.query_engine import PandasQueryEngine # noqa: F401
return True
except ImportError:
return False Try / catch
try:
index = PandasIndex(df=df)
except DeprecationWarning as e:
if 'llama-index-experimental' in str(e):
from llama_index.experimental.query_engine import PandasQueryEngine
query_engine = PandasQueryEngine(df=df)
else:
raise Prevention
- After any llama-index upgrade, grep for imports under core that moved to integration/experimental packages
- Run PandasQueryEngine only in sandboxed environments since it executes generated code
When it happens
Trigger: Calling PandasIndex(...) or GPTPandasIndex(...) on llama-index-core after the removal (roughly v0.10.44+); running old notebooks/scripts built before the move.
Common situations: Upgrading llama-index past the deprecation boundary; tutorials showing the old core import path; CI suddenly failing after a dependency bump.
Related errors
- PandasInstructionParser has been moved to `llama-index-exper
- JSONalyzeQueryEngine has been moved to `llama-index-experime
- PandasQueryEngine has been moved to `llama-index-experimenta
- This class is deprecated. Use any LLM class directly.
- ChatMessage contains multiple blocks, use 'ChatMessage.block
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/48e57b1732c91188.
Report an issue: GitHub.