crewAIInc/crewAI · error · ImportError
`patronus` package not found, please run `uv add patronus`
Error message
`patronus` package not found, please run `uv add patronus`
What it means
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.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/patronus_eval_tool/patronus_local_evaluator_tool.py:78
self._generate_description()
else:
raise ImportError
except ImportError:
import click
if click.confirm(
"You are missing the 'patronus' package. Would you like to install it?"
):
import subprocess
try:
subprocess.run(["uv", "add", "patronus"], check=True) # noqa: S607
self.client = patronus_client
self._generate_description()
except subprocess.CalledProcessError as e:
raise ImportError("Failed to install 'patronus' package") from e
else:
raise ImportError(
"`patronus` package not found, please run `uv add patronus`"
) from None
def _run(
self,
**kwargs: Any,
) -> Any:
evaluated_model_input = kwargs.get("evaluated_model_input")
evaluated_model_output = kwargs.get("evaluated_model_output")
evaluated_model_retrieved_context = kwargs.get(
"evaluated_model_retrieved_context"
)
evaluated_model_gold_answer = self.evaluated_model_gold_answer
evaluator = self.evaluator
result: Any = self.client.evaluate(
evaluator=evaluator,
evaluated_model_input=evaluated_model_input,View on GitHub (pinned to 754d7323be)
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
Example fix
# before $ python main.py # > You are missing the 'patronus' package. Would you like to install it? n # ImportError: `patronus` package not found, please run `uv add patronus` # after $ uv add patronus $ python main.py
Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
def patronus_available() -> bool:
return importlib.util.find_spec("patronus") is not None
assert patronus_available(), "Run: uv add patronus (or pip install patronus)" Try / catch
try:
tool = PatronusLocalEvaluatorTool(...)
except ImportError as e:
raise SystemExit(f"Dependency missing: {e}. Install with: uv add patronus") from e Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Failed to install 'patronus' package
- `scrapegraph-py` package not found, please run `uv add scrap
- You are missing the 'weaviate-client' package. Would you lik
- `minds_sdk` package not found, please run `pip install minds
- Could not import langchain_apify python package. Please inst
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/c0a91aa3013e3ff2.
Report an issue: GitHub.