{"record":{"id":"cee85f4b0ae8e3fc","repo":"crewAIInc/crewAI","slug":"the-tavily-python-package-is-required-click-a-cee85f","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","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":67,"sourceCode":"            ),\n        ]\n    )\n\n    def __init__(self, **kwargs: Any):\n        super().__init__(**kwargs)\n        if TAVILY_AVAILABLE:\n            api_key = os.getenv(\"TAVILY_API_KEY\")\n            self._client = TavilyClient(api_key=api_key, client_name=\"crewai\")\n            self._async_client = AsyncTavilyClient(\n                api_key=api_key, client_name=\"crewai\"\n            )\n        else:\n            try:\n                import subprocess\n\n                import click\n            except ImportError as e:\n                raise ImportError(\n                    \"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:","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/tavily_get_research_tool/tavily_get_research_tool.py#L49-L85","documentation":"TavilyGetResearchTool raises this ImportError in __init__ when tavily-python is missing and the installer helpers (click, subprocess) cannot be imported either. Unlike the extractor tool, this variant uses pip-style guidance and chains the original ImportError via `from e`. The prompt path is never reached because the helper imports fail first.","triggerScenarios":"Constructing TavilyGetResearchTool where TAVILY_AVAILABLE is False and click (or subprocess) is unimportable — missing click install, restricted interpreter, or broken sys.path.","commonSituations":"Minimal containers without click; sandboxes that forbid subprocess; environments where crewai-tools was installed without its tavily extra and click is not otherwise pulled in.","solutions":["pip install tavily-python (or uv add tavily-python) before constructing the tool.","Ensure click is installed: pip install click.","In subprocess-restricted runtimes, pre-install dependencies so the fallback is never exercised."],"exampleFix":"# before\ntool = TavilyGetResearchTool()  # -> ImportError\n\n# after\n# shell: pip install tavily-python click\ntool = TavilyGetResearchTool()","handlingStrategy":"try-catch","validationCode":"import importlib.util\nif importlib.util.find_spec(\"tavily\") is None or importlib.util.find_spec(\"click\") is None:\n    raise SystemExit(\"Install first: pip install tavily-python click\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = TavilyGetResearchTool()\nexcept ImportError as e:\n    raise SystemExit(f\"Dependency missing: {e}. Run: pip install tavily-python\") from e","preventionTips":["Add tavily-python and click to pinned project dependencies.","Fail fast at startup with importlib checks instead of hitting constructor errors.","Avoid relying on runtime installer prompts in automated environments."],"tags":["tavily","dependency","import-error","crewai-tools","installation"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}