run-llama/llama_index · error · DeprecationWarning

PandasInstructionParser has been moved to `llama-index-exper

Error message

PandasInstructionParser has been moved to `llama-index-experimental`.
`pip install llama-index-experimental`
`from llama_index.experimental.query_engine.pandas import PandasInstructionParser`
Note that the PandasInstructionParser allows for arbitrary code execution, 
and should be used in a secure environment.

What it means

PandasInstructionParser survives in llama-index-core only as a tombstone class: its __init__ unconditionally raises DeprecationWarning pointing to llama-index-experimental, where the pandas query-engine stack moved. The note about arbitrary code execution is deliberate — the parser generates and exec()s pandas code over your DataFrame, so it must only run in trusted contexts.

Source

Thrown at llama-index-core/llama_index/core/query_engine/pandas/output_parser.py:19

"""
Pandas output parser.

DEPRECATED: This class has been moved to `llama-index-experimental`.
"""

from typing import Any


class PandasInstructionParser:
    """
    Pandas instruction parser.

    DEPRECATED: This class has been moved to `llama-index-experimental`.

    """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        raise DeprecationWarning(
            "PandasInstructionParser has been moved to `llama-index-experimental`.\n"
            "`pip install llama-index-experimental`\n"
            "`from llama_index.experimental.query_engine.pandas import PandasInstructionParser`\n"
            "Note that the PandasInstructionParser allows for arbitrary code execution, \n"
            "and should be used in a secure environment."
        )

View on GitHub (pinned to afd0fef371)

Solutions

  1. pip install llama-index-experimental and import from llama_index.experimental.query_engine.pandas (the whole PandasQueryEngine + parser live there).
  2. Grep the codebase for 'core.query_engine.pandas' and update every import path.
  3. Treat the exec path as untrusted: only run against DataFrames whose source data is trusted, ideally in a sandboxed/locked-down environment.
  4. If the experimental package is not an option, write your own CustomQueryEngine that prompts for pandas expressions and evaluates them with your own safety checks.

Example fix

# before
from llama_index.core.query_engine.pandas.output_parser import PandasInstructionParser
parser = PandasInstructionParser(df)  # raises DeprecationWarning

# after
# pip install llama-index-experimental
from llama_index.experimental.query_engine.pandas import (
    PandasInstructionParser,
    PandasQueryEngine,
)
engine = PandasQueryEngine(df=df, instruction_parser=PandasInstructionParser(df))
Defensive patterns

Strategy: fallback

Validate before calling

try:
    from llama_index.experimental.query_engine.pandas import PandasInstructionParser  # noqa
    HAS_EXPERIMENTAL = True
except ImportError:
    HAS_EXPERIMENTAL = False

if not HAS_EXPERIMENTAL:
    raise SystemExit("pip install llama-index-experimental for PandasInstructionParser")

Try / catch

try:
    parser = PandasInstructionParser(df)
except DeprecationWarning:
    from llama_index.experimental.query_engine.pandas import PandasInstructionParser as ExpParser
    parser = ExpParser(df)

Prevention

When it happens

Trigger: Instantiating PandasInstructionParser(...) with any arguments after upgrading llama-index-core past the removal — the import still works (the class exists), so the failure appears at construction, typically inside PandasQueryEngine setup.

Common situations: Following older llama-index pandas tutorials that import from llama_index.core.query_engine.pandas.output_parser; upgrading llama-index-core without adding the experimental package; CI catching it the first time a notebook builds a PandasQueryEngine.

Related errors


AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15). Data as JSON: /api/errors/d54a9494cf980b3e. Report an issue: GitHub.