{"record":{"id":"c8d11b2db6880cba","repo":"crewAIInc/crewAI","slug":"attempted-to-install-tavily-python-but-failed-c8d11b","errorCode":null,"errorMessage":"Attempted to install 'tavily-python' but failed: {e}. Please install it manually to use the TavilyGetResearchTool.","messagePattern":"Attempted to install 'tavily-python' but failed: (.+?)\\. Please install it manually to use the TavilyGetResearchTool\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/tavily_get_research_tool/tavily_get_research_tool.py","lineNumber":86,"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 TavilyGetResearchTool. 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 TavilyGetResearchTool.\"\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 TavilyGetResearchTool.\"\n                    ) from e\n            else:\n                raise ImportError(\n                    \"The 'tavily-python' package is required to use the \"\n                    \"TavilyGetResearchTool. 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(self, request_id: str) -> str:\n        \"\"\"Synchronously retrieves Tavily research task status and results.\"\"\"\n        if not self._client:","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/tavily_get_research_tool/tavily_get_research_tool.py#L68-L104","documentation":"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).","triggerScenarios":"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.","commonSituations":"CI without network egress; running `uv add` semantics in a directory without a uv-managed project; permission-restricted filesystems.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import shutil, importlib.util\nif importlib.util.find_spec(\"tavily\") is None:\n    if shutil.which(\"uv\") is None and shutil.which(\"pip\") is None:\n        raise SystemExit(\"No installer on PATH; install tavily-python manually\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = TavilyGetResearchTool()\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(\"tavily-python installed; restart the app\") from e\n    raise","preventionTips":["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."],"tags":["tavily","installation","uv","subprocess","network","crewai-tools"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}