crewAIInc/crewAI · error · ImportError
The 'tavily-python' package is required to use the TavilyGet
Error message
The 'tavily-python' package is required to use the TavilyGetResearchTool. Please install it with: uv add tavily-python
What it means
TavilyGetResearchTool raises this ImportError when the operator declines the interactive install prompt (click.confirm returns False). It is the refusal branch: no dependency was installed and the tool cannot function, so construction aborts with explicit install instructions (uv add tavily-python).
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/tavily_get_research_tool/tavily_get_research_tool.py:91
) from e
if click.confirm(
"You are missing the 'tavily-python' package, which is required "
"for TavilyGetResearchTool. Would you like to install it?"
):
try:
subprocess.run(["uv", "add", "tavily-python"], check=True) # noqa: S607
raise ImportError(
"'tavily-python' has been installed. Please restart your "
"Python application to use the TavilyGetResearchTool."
)
except subprocess.CalledProcessError as e:
raise ImportError(
f"Attempted to install 'tavily-python' but failed: {e}. "
"Please install it manually to use the TavilyGetResearchTool."
) from e
else:
raise ImportError(
"The 'tavily-python' package is required to use the "
"TavilyGetResearchTool. Please install it with: uv add tavily-python"
)
@staticmethod
def _stringify_response(response: Any) -> str:
if isinstance(response, str):
return response
return json.dumps(response, indent=2)
def _run(self, request_id: str) -> str:
"""Synchronously retrieves Tavily research task status and results."""
if not self._client:
raise ValueError(
"Tavily client is not initialized. Ensure 'tavily-python' is "
"installed and API key is set."
)
View on GitHub (pinned to 754d7323be)
Solutions
- Install the package: uv add tavily-python (or pip install tavily-python), then re-create the tool.
- Pre-install dependencies in your Dockerfile/CI so interactive prompts never appear.
- Run tools non-interactively only after tavily-python is present in the image/env.
Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
if importlib.util.find_spec("tavily") is None:
raise SystemExit("tavily-python required. Install: uv add tavily-python") Try / catch
try:
tool = TavilyGetResearchTool()
except ImportError as e:
if "required to use the" in str(e):
log.error("Install declined; aborting Tavily tool setup")
raise Prevention
- Pre-install tavily-python in images/CI so no confirmation prompt appears.
- Keep stdin interactive OR dependencies pre-installed; never both missing.
- List Tavily dependencies explicitly in project requirements.
When it happens
Trigger: TavilyGetResearchTool.__init__ with tavily-python absent and the confirm prompt answered 'n' (or effectively declined under non-interactive stdin).
Common situations: Interactive shells where the user says no; automated scripts with closed stdin causing click.confirm to decline/abort.
Related errors
- The 'tavily-python' package is required to use the TavilyExt
- The 'tavily-python' package is required to use the TavilyRes
- The 'tavily-python' package is required. 'click' and 'subpro
- 'tavily-python' has been installed. Please restart your Pyth
- The 'tavily-python' package is required. 'click' and 'subpro
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/7fa755b239089f98.
Report an issue: GitHub.