crewAIInc/crewAI · error · ImportError
The 'tavily-python' package is required. 'click' and 'subpro
Error message
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.
What it means
TavilyExtractorTool raises this ImportError during __init__ when 'tavily-python' is absent AND the fallback installer helpers ('click' and 'subprocess' modules) also cannot be imported. The interactive install prompt is never reached because the helper imports fail first. Note the message is slightly misleading: 'subprocess' is stdlib, so in practice this fires when click is missing or imports are blocked.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/tavily_extractor_tool/tavily_extractor_tool.py:102
Args:
**kwargs: Additional keyword arguments.
"""
super().__init__(**kwargs)
if TAVILY_AVAILABLE:
self.client = TavilyClient(
api_key=self.api_key, proxies=self.proxies, client_name="crewai"
)
self.async_client = AsyncTavilyClient(
api_key=self.api_key, proxies=self.proxies, client_name="crewai"
)
else:
try:
import subprocess
import click
except ImportError:
raise ImportError(
"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:View on GitHub (pinned to 754d7323be)
Solutions
- Install the dependency directly: uv add tavily-python (or pip install tavily-python), then recreate the tool.
- Ensure click is installed: uv add click.
- If in a sandbox that blocks subprocess, run in an environment that allows it, or pre-install tavily-python so the fallback path is never taken.
Example fix
# before tool = TavilyExtractorTool() # -> ImportError about tavily-python/click/subprocess # after # shell: uv add tavily-python click tool = TavilyExtractorTool()
Defensive patterns
Strategy: try-catch
Validate before calling
import importlib.util
TAVILY_READY = importlib.util.find_spec("tavily") is not None and importlib.util.find_spec("click") is not None
if not TAVILY_READY:
raise SystemExit("Install first: uv add tavily-python click") Try / catch
try:
tool = TavilyExtractorTool(api_key=...)
except ImportError as e:
raise SystemExit(f"Missing dependency: {e}. Run: uv add tavily-python click") from e Prevention
- Declare tavily-python (and click) in project dependencies instead of relying on runtime auto-install.
- For non-interactive environments, never depend on click.confirm prompts; pre-install everything.
- Wrap Tavily tool construction in a startup check that verifies importability.
When it happens
Trigger: Instantiating TavilyExtractorTool in an environment where TAVILY_AVAILABLE is False and either click is not installed or an import hook/permission blocks importing click or subprocess (e.g. restricted sandbox, broken sys.path).
Common situations: Installing crewai-tools without the tavily extra and also lacking click (rare, since click is a near-universal transitive dep); running under a locked-down environment that forbids subprocess; a corrupted venv where stdlib paths are broken.
Related errors
- The 'tavily-python' package is required. 'click' and 'subpro
- The 'tavily-python' package is required. 'click' and 'subpro
- The 'tavily-python' package is required. 'click' and 'subpro
- 'tavily-python' has been installed. Please restart your Pyth
- The 'tavily-python' package is required to use the TavilyExt
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/1f72eec0e57842de.
Report an issue: GitHub.