crewAIInc/crewAI · error · ImportError
The 'tavily-python' package is required to use the TavilyExt
Error message
The 'tavily-python' package is required to use the TavilyExtractorTool. Please install it with: uv add tavily-python
What it means
TavilyExtractorTool raises this ImportError when the interactive click.confirm prompt asks to install tavily-python and the user declines (answers 'n'). It is the explicit 'user refused the fix' branch; the tool refuses to construct without its required client library.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/tavily_extractor_tool/tavily_extractor_tool.py:121
"The 'tavily-python' package is required. 'click' and 'subprocess' are also needed to assist with installation if the package is missing. "
"Please install 'tavily-python' manually (e.g., 'uv add tavily-python') and ensure 'click' and 'subprocess' are available."
) from None
if click.confirm(
"You are missing the 'tavily-python' package, which is required for TavilyExtractorTool. Would you like to install it?"
):
try:
subprocess.run(["uv pip", "install", "tavily-python"], check=True) # noqa: S607
raise ImportError(
"'tavily-python' has been installed. Please restart your Python application to use the TavilyExtractorTool."
)
except subprocess.CalledProcessError as e:
raise ImportError(
f"Attempted to install 'tavily-python' but failed: {e}. "
f"Please install it manually to use the TavilyExtractorTool."
) from e
else:
raise ImportError(
"The 'tavily-python' package is required to use the TavilyExtractorTool. "
"Please install it with: uv add tavily-python"
)
def _run(
self,
urls: list[str] | str,
) -> str:
"""Synchronously extracts content from the given URL(s).
Args:
urls: The URL(s) to extract data from.
Returns:
A JSON string containing the extracted data.
"""
if not self.client:
raise ValueError(View on GitHub (pinned to 754d7323be)
Solutions
- Install the package and retry: uv add tavily-python (or pip install tavily-python).
- If running non-interactively, pre-install tavily-python so the prompt never appears.
- Set TAVILY_API_KEY and add tavily-python to your project dependencies to make first-run deterministic.
Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
if importlib.util.find_spec("tavily") is None:
raise SystemExit("tavily-python required. Install with: uv add tavily-python") Try / catch
try:
tool = TavilyExtractorTool()
except ImportError as e:
if "required to use the TavilyExtractorTool" in str(e):
log.error("User declined tavily install; provisioning dependency automatically")
raise
raise Prevention
- Pre-install dependencies in Docker/CI images so prompts cannot be declined.
- Run tools with stdin available or pre-installed deps when non-interactive.
- Document tavily-python as a hard requirement for Tavily tools.
When it happens
Trigger: TavilyExtractorTool.__init__ with tavily-python missing and the operator answering 'no' to the confirmation prompt (or a non-TTY/automated harness whose stdin yields a falsy answer).
Common situations: Interactive sessions where the user is unsure about adding dependencies; scripts run with stdin closed so click.confirm defaults to aborting/declining.
Related errors
- The 'tavily-python' package is required to use the TavilyGet
- 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/cd9ef44c20a74c67.
Report an issue: GitHub.