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 TavilyResearchTool. What it means
TavilyResearchTool raises this when the accepted auto-install (`uv add tavily-python`) fails with CalledProcessError, embedding the subprocess error. Distinguish it from FileNotFoundError (uv binary absent), which this except clause does not catch. The message tells you to install manually for TavilyResearchTool usage.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/tavily_research_tool/tavily_research_tool.py:122
"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 TavilyResearchTool. 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 TavilyResearchTool."
)
except subprocess.CalledProcessError as e:
raise ImportError(
f"Attempted to install 'tavily-python' but failed: {e}. "
"Please install it manually to use the TavilyResearchTool."
) from e
else:
raise ImportError(
"The 'tavily-python' package is required to use the "
"TavilyResearchTool. 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,
input: str,View on GitHub (pinned to 754d7323be)
Solutions
- Manually run uv add tavily-python from the project root (or pip install tavily-python).
- If `uv add` complains about a missing project, run `uv init` or use `uv pip install tavily-python`.
- Fix network/proxy config (UV_INDEX_URL / HTTPS_PROXY) and retry.
- Verify uv is installed and reachable on PATH.
Defensive patterns
Strategy: try-catch
Validate before calling
import shutil, importlib.util
if importlib.util.find_spec("tavily") is None and shutil.which("uv") is None:
raise SystemExit("uv unavailable and tavily-python missing; install manually") Try / catch
try:
tool = TavilyResearchTool()
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("Installed; restart required") from e
raise Prevention
- Run `uv add tavily-python` inside a uv project, or `pip install tavily-python`, ahead of time.
- Check network egress and index/proxy settings in CI before relying on installs.
- Ensure the working directory is writable when using `uv add`.
When it happens
Trigger: Install prompt accepted; uv invoked but failing: no network, proxy blocking, missing pyproject.toml for `uv add`, or unwritable project dir.
Common situations: Offline CI; running from a directory that is not a uv project; corporate proxies; read-only mounts.
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/4171c59b4f5cdb98.
Report an issue: GitHub.