{"record":{"id":"c0a91aa3013e3ff2","repo":"crewAIInc/crewAI","slug":"patronus-package-not-found-please-run-uv-add-p","errorCode":null,"errorMessage":"`patronus` package not found, please run `uv add patronus`","messagePattern":"`patronus` package not found, please run `uv add patronus`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/patronus_eval_tool/patronus_local_evaluator_tool.py","lineNumber":78,"sourceCode":"                self._generate_description()\n            else:\n                raise ImportError\n        except ImportError:\n            import click\n\n            if click.confirm(\n                \"You are missing the 'patronus' package. Would you like to install it?\"\n            ):\n                import subprocess\n\n                try:\n                    subprocess.run([\"uv\", \"add\", \"patronus\"], check=True)  # noqa: S607\n                    self.client = patronus_client\n                    self._generate_description()\n                except subprocess.CalledProcessError as e:\n                    raise ImportError(\"Failed to install 'patronus' package\") from e\n            else:\n                raise ImportError(\n                    \"`patronus` package not found, please run `uv add patronus`\"\n                ) from None\n\n    def _run(\n        self,\n        **kwargs: Any,\n    ) -> Any:\n        evaluated_model_input = kwargs.get(\"evaluated_model_input\")\n        evaluated_model_output = kwargs.get(\"evaluated_model_output\")\n        evaluated_model_retrieved_context = kwargs.get(\n            \"evaluated_model_retrieved_context\"\n        )\n        evaluated_model_gold_answer = self.evaluated_model_gold_answer\n        evaluator = self.evaluator\n\n        result: Any = self.client.evaluate(\n            evaluator=evaluator,\n            evaluated_model_input=evaluated_model_input,","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/patronus_eval_tool/patronus_local_evaluator_tool.py#L60-L96","documentation":"Raised by PatronusLocalEvaluatorTool when the patronus package is not importable and the user declines the interactive install prompt (click.confirm returns False). It is the deliberate 'user said no' branch; the exception from None suppresses the import-error context and tells you the exact command to run.","triggerScenarios":"patronus is not installed in the active environment, the constructor fires the click.confirm prompt, and the operator answers 'n' (or stdin is non-interactive and confirm defaults to abort).","commonSituations":"Non-interactive contexts (CI, dockerized runs, piped stdin) where click.confirm cannot get a yes; developers declining the install to keep the environment clean; running with a system Python the tool cannot modify.","solutions":["Install the package yourself: uv add patronus (or pip install patronus) in the project's virtual environment","Confirm you are installing into the same interpreter/venv the tool runs under (which python / which uv)","For CI, add patronus to requirements before the run so the prompt never appears","If stdin is non-interactive, pipe 'yes' or pre-install instead of relying on the prompt"],"exampleFix":"# before\n$ python main.py\n# > You are missing the 'patronus' package. Would you like to install it? n\n# ImportError: `patronus` package not found, please run `uv add patronus`\n\n# after\n$ uv add patronus\n$ python main.py\n","handlingStrategy":"validation","validationCode":"import importlib.util\n\ndef patronus_available() -> bool:\n    return importlib.util.find_spec(\"patronus\") is not None\n\nassert patronus_available(), \"Run: uv add patronus (or pip install patronus)\"","typeGuard":null,"tryCatchPattern":"try:\n    tool = PatronusLocalEvaluatorTool(...)\nexcept ImportError as e:\n    raise SystemExit(f\"Dependency missing: {e}. Install with: uv add patronus\") from e","preventionTips":["Add patronus to project dependencies up front","Provide stdin ('yes |') only if you intentionally accept the auto-install","Keep CI scripts non-interactive by pre-installing","Check find_spec('patronus') in a startup smoke test"],"tags":["installation","dependencies","interactive-prompt","patronus"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}