{"record":{"id":"4171c59b4f5cdb98","repo":"crewAIInc/crewAI","slug":"attempted-to-install-tavily-python-but-failed-4171c5","errorCode":null,"errorMessage":"Attempted to install 'tavily-python' but failed: {e}. Please install it manually to use the TavilyResearchTool.","messagePattern":"Attempted to install 'tavily-python' but failed: (.+?)\\. Please install it manually to use the TavilyResearchTool\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/tavily_research_tool/tavily_research_tool.py","lineNumber":122,"sourceCode":"                    \"The 'tavily-python' package is required. 'click' and \"\n                    \"'subprocess' are also needed to assist with installation \"\n                    \"if the package is missing. Please install 'tavily-python' \"\n                    \"manually (e.g., 'pip install tavily-python') and ensure \"\n                    \"'click' and 'subprocess' are available.\"\n                ) from e\n\n            if click.confirm(\n                \"You are missing the 'tavily-python' package, which is required \"\n                \"for TavilyResearchTool. Would you like to install it?\"\n            ):\n                try:\n                    subprocess.run([\"uv\", \"add\", \"tavily-python\"], check=True)  # noqa: S607\n                    raise ImportError(\n                        \"'tavily-python' has been installed. Please restart your \"\n                        \"Python application to use the TavilyResearchTool.\"\n                    )\n                except subprocess.CalledProcessError as e:\n                    raise ImportError(\n                        f\"Attempted to install 'tavily-python' but failed: {e}. \"\n                        \"Please install it manually to use the TavilyResearchTool.\"\n                    ) from e\n            else:\n                raise ImportError(\n                    \"The 'tavily-python' package is required to use the \"\n                    \"TavilyResearchTool. Please install it with: uv add tavily-python\"\n                )\n\n    @staticmethod\n    def _stringify_response(response: Any) -> str:\n        if isinstance(response, str):\n            return response\n        return json.dumps(response, indent=2)\n\n    def _run(\n        self,\n        input: str,","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/tavily_research_tool/tavily_research_tool.py#L104-L140","documentation":"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.","triggerScenarios":"Install prompt accepted; uv invoked but failing: no network, proxy blocking, missing pyproject.toml for `uv add`, or unwritable project dir.","commonSituations":"Offline CI; running from a directory that is not a uv project; corporate proxies; read-only mounts.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import shutil, importlib.util\nif importlib.util.find_spec(\"tavily\") is None and shutil.which(\"uv\") is None:\n    raise SystemExit(\"uv unavailable and tavily-python missing; install manually\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = TavilyResearchTool()\nexcept ImportError as e:\n    if \"Attempted to install 'tavily-python' but failed\" in str(e):\n        subprocess.run([\"pip\", \"install\", \"tavily-python\"], check=True)\n        raise SystemExit(\"Installed; restart required\") from e\n    raise","preventionTips":["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`."],"tags":["tavily","installation","uv","subprocess","network","crewai-tools"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}