MiniMax-AI/skills · critical · RuntimeError

pandas is not installed. Run: pip install pandas openpyxl

Error message

pandas is not installed. Run: pip install pandas openpyxl

What it means

detect_and_load() tries 'import pandas' at call time; if the dependency is missing it raises RuntimeError with install instructions. The import is deferred so module load never fails, but pandas is mandatory for every supported format. Note: .xlsx also needs openpyxl at read time, which the message correctly includes.

Source

Thrown at skills/minimax-xlsx/scripts/xlsx_reader.py:40

import argparse
from pathlib import Path


# ---------------------------------------------------------------------------
# Format detection and loading
# ---------------------------------------------------------------------------

def detect_and_load(file_path: str, sheet_name_filter: str | None = None) -> dict:
    """
    Load file into {sheet_name: DataFrame} dict.
    CSV/TSV files are mapped to a single-key dict using the file stem as key.

    Raises ValueError for unsupported formats or encoding failures.
    """
    try:
        import pandas as pd
    except ImportError:
        raise RuntimeError(
            "pandas is not installed. Run: pip install pandas openpyxl"
        )

    path = Path(file_path)
    if not path.exists():
        raise FileNotFoundError(f"File not found: {file_path}")

    suffix = path.suffix.lower()

    if suffix in (".xlsx", ".xlsm"):
        target = sheet_name_filter if sheet_name_filter else None
        result = pd.read_excel(file_path, sheet_name=target)
        # pd.read_excel with sheet_name=None returns dict; with a name, returns DataFrame
        if isinstance(result, dict):
            return result
        else:
            return {sheet_name_filter: result}

View on GitHub (pinned to 60aaae52bb)

Solutions

  1. pip install pandas openpyxl
  2. Pin compatible versions if there is a conflict: pip install 'pandas>=2.0' openpyxl
  3. Activate the correct virtualenv before running.

Example fix

# before
python3 xlsx_reader.py data.xlsx   # RuntimeError: pandas is not installed

# after
pip install pandas openpyxl
python3 xlsx_reader.py data.xlsx
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util
for mod in ('pandas', 'openpyxl'):
    if importlib.util.find_spec(mod) is None:
        raise RuntimeError(f'{mod} is not installed. Run: pip install pandas openpyxl')

Try / catch

try:
    sheets = detect_and_load(path)
except RuntimeError as e:
    if 'pandas' in str(e):
        print('Install deps: pip install pandas openpyxl', file=sys.stderr)
    raise

Prevention

When it happens

Trigger: Running xlsx_reader.py in an environment where pandas is not installed (any format), or where openpyxl is missing (for .xlsx/.xlsm).

Common situations: Fresh virtualenv without deps; system Python lacking pandas; CI image missing packages; pandas installed but openpyxl not, so .xlsx fails later inside pd.read_excel.

Related errors


AI-assisted analysis of MiniMax-AI/skills@60aaae52bb (2026-08-13). Data as JSON: /api/errors/925828ca0a473b07. Report an issue: GitHub.