anthropics/financial-services · error · ImportError
openpyxl not installed. Run: pip install openpyxl
Error message
openpyxl not installed. Run: pip install openpyxl
What it means
Raised in DCFModelValidator.__init__ of the pitch-agent copy of validate_dcf.py when the Python interpreter cannot import openpyxl, the library used to read Excel workbooks (both formulas and cached values). The validator converts the raw ImportError into a message with install instructions. It is an environment problem, not a model or code problem.
Source
Thrown at plugins/agent-plugins/pitch-agent/skills/dcf-model/scripts/validate_dcf.py:20
"""
DCF Model Validation Script
Validates Excel DCF models for formula errors and common DCF mistakes
"""
import sys
import json
from pathlib import Path
from typing import Optional
class DCFModelValidator:
"""Validates DCF models for errors and quality issues"""
def __init__(self, excel_path: str):
try:
import openpyxl
except ImportError:
raise ImportError("openpyxl not installed. Run: pip install openpyxl")
self.excel_path = excel_path
self.openpyxl = openpyxl
if not Path(excel_path).exists():
raise FileNotFoundError(f"File not found: {excel_path}")
self.workbook_formulas = openpyxl.load_workbook(excel_path, data_only=False)
self.workbook_values = openpyxl.load_workbook(excel_path, data_only=True)
self.errors = []
self.warnings = []
self.info = []
def validate_all(self) -> dict:
"""
Run all validation checks
Returns:View on GitHub (pinned to 69cbc81467)
Solutions
- Install into the same interpreter you run the script with: python -m pip install openpyxl
- Install any requirements file shipped with the skill: python -m pip install -r skills/dcf-model/scripts/requirements.txt (if present)
- Verify with: python -c 'import openpyxl; print(openpyxl.__version__)' before re-running
- Bake openpyxl into the skill runtime image / setup docs so pitch-agent sessions have it by default
Example fix
# before python skills/dcf-model/scripts/validate_dcf.py pitch_model.xlsx # ImportError: openpyxl not installed. Run: pip install openpyxl # after python -m pip install openpyxl python skills/dcf-model/scripts/validate_dcf.py pitch_model.xlsx
Defensive patterns
Strategy: try-catch
Validate before calling
import importlib.util
if importlib.util.find_spec('openpyxl') is None:
raise SystemExit('openpyxl missing: python -m pip install openpyxl') Type guard
def has_openpyxl() -> bool:
return importlib.util.find_spec('openpyxl') is not None Try / catch
try:
validator = DCFModelValidator(path)
except ImportError as e:
raise SystemExit(f'Dependency error: {e}. Install with: python -m pip install openpyxl') Prevention
- Install openpyxl in the pitch-agent runtime image or setup script
- Use python -m pip so the package lands in the executing interpreter
- Add a preflight importlib.util.find_spec('openpyxl') check before skill scripts run
When it happens
Trigger: Instantiating DCFModelValidator(excel_path) in an environment where openpyxl is not installed, e.g. running the pitch-agent skill script in a sandbox or container with a bare Python install. The try: import openpyxl at the top of __init__ fails and re-raises ImportError with this message.
Common situations: Agent runtime containers that provision skills but not Python packages; running with a different interpreter than the one pip installed into (pip vs python -m pip); fresh clones without dependency install; conda/venv not activated before running the script.
Related errors
- openpyxl not installed. Run: pip install openpyxl
- openpyxl not installed. Run: pip install openpyxl
- File not found: {excel_path}
- File not found: {excel_path}
- File not found: {excel_path}
AI-assisted analysis of anthropics/financial-services@69cbc81467 (2026-08-27).
Data as JSON: /api/errors/3c51a24ea667df1d.
Report an issue: GitHub.