{"record":{"id":"3c51a24ea667df1d","repo":"anthropics/financial-services","slug":"openpyxl-not-installed-run-pip-install-openpyxl-3c51a2","errorCode":null,"errorMessage":"openpyxl not installed. Run: pip install openpyxl","messagePattern":"openpyxl not installed\\. Run: pip install openpyxl","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"plugins/agent-plugins/pitch-agent/skills/dcf-model/scripts/validate_dcf.py","lineNumber":20,"sourceCode":"\"\"\"\nDCF Model Validation Script\nValidates Excel DCF models for formula errors and common DCF mistakes\n\"\"\"\n\nimport sys\nimport json\nfrom pathlib import Path\nfrom typing import Optional\n\n\nclass DCFModelValidator:\n    \"\"\"Validates DCF models for errors and quality issues\"\"\"\n\n    def __init__(self, excel_path: str):\n        try:\n            import openpyxl\n        except ImportError:\n            raise ImportError(\"openpyxl not installed. Run: pip install openpyxl\")\n\n        self.excel_path = excel_path\n        self.openpyxl = openpyxl\n\n        if not Path(excel_path).exists():\n            raise FileNotFoundError(f\"File not found: {excel_path}\")\n\n        self.workbook_formulas = openpyxl.load_workbook(excel_path, data_only=False)\n        self.workbook_values = openpyxl.load_workbook(excel_path, data_only=True)\n        self.errors = []\n        self.warnings = []\n        self.info = []\n        \n    def validate_all(self) -> dict:\n        \"\"\"\n        Run all validation checks\n\n        Returns:","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/anthropics/financial-services/blob/69cbc81467a5dced793eee03dec4658aa24ef856/plugins/agent-plugins/pitch-agent/skills/dcf-model/scripts/validate_dcf.py#L2-L38","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\npython skills/dcf-model/scripts/validate_dcf.py pitch_model.xlsx\n# ImportError: openpyxl not installed. Run: pip install openpyxl\n\n# after\npython -m pip install openpyxl\npython skills/dcf-model/scripts/validate_dcf.py pitch_model.xlsx","handlingStrategy":"try-catch","validationCode":"import importlib.util\nif importlib.util.find_spec('openpyxl') is None:\n    raise SystemExit('openpyxl missing: python -m pip install openpyxl')","typeGuard":"def has_openpyxl() -> bool:\n    return importlib.util.find_spec('openpyxl') is not None","tryCatchPattern":"try:\n    validator = DCFModelValidator(path)\nexcept ImportError as e:\n    raise SystemExit(f'Dependency error: {e}. Install with: python -m pip install openpyxl')","preventionTips":["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"],"tags":["python","openpyxl","dependency","import-error","excel"],"backgroundTag":"missing-python-dependency","analyzedSha":"69cbc81467a5dced793eee03dec4658aa24ef856","analyzedAt":"2026-08-27T12:38:04.061Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}