crewAIInc/crewAI · error · ImportError
Attempted to install 'tavily-python' but failed: {e}. Please
Error message
Attempted to install 'tavily-python' but failed: {e}. Please install it manually to use the TavilyGetResearchTool. What it means
TavilyGetResearchTool raises this when the accepted auto-install command `uv add tavily-python` fails with CalledProcessError; the command's stderr/exit info is inlined into the message. It means the installer itself ran and errored (uv missing from PATH yields FileNotFoundError instead, which is NOT caught).
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/tavily_get_research_tool/tavily_get_research_tool.py:86
"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., 'pip install tavily-python') and ensure "
"'click' and 'subprocess' are available."
) 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:View on GitHub (pinned to 754d7323be)
Solutions
- Install manually: uv add tavily-python from the project root, or pip install tavily-python, then retry tool construction.
- If `uv add` fails due to a missing pyproject.toml, initialize the project or use `uv pip install tavily-python` instead.
- Fix network/proxy (PIP_INDEX_URL, UV_INDEX_URL, HTTPS_PROXY) and retry.
- Ensure uv is installed and on PATH.
Defensive patterns
Strategy: try-catch
Validate before calling
import shutil, importlib.util
if importlib.util.find_spec("tavily") is None:
if shutil.which("uv") is None and shutil.which("pip") is None:
raise SystemExit("No installer on PATH; install tavily-python manually") Try / catch
try:
tool = TavilyGetResearchTool()
except ImportError as e:
if "Attempted to install 'tavily-python' but failed" in str(e):
subprocess.run(["pip", "install", "tavily-python"], check=True)
raise SystemExit("tavily-python installed; restart the app") from e
raise Prevention
- Run `uv add tavily-python` from a uv-managed project root, or use pip, before launching.
- Ensure network access and correct index/proxy configuration for installers in CI.
- Confirm uv is installed and on PATH in deployment images.
When it happens
Trigger: User confirms install; uv runs but exits non-zero — offline network, proxy blocking PyPI, uv operating outside a project (no pyproject.toml for `uv add`), or read-only project directory.
Common situations: CI without network egress; running `uv add` semantics in a directory without a uv-managed project; permission-restricted filesystems.
Related errors
- Attempted to install 'tavily-python' but failed: {e}. Please
- Attempted to install 'tavily-python' but failed: {e}. Please
- Attempted to install 'tavily-python' but failed: {e}. Please
- Failed to install mcp package
- Failed to install 'patronus' package
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/c8d11b2db6880cba.
Report an issue: GitHub.