{"record":{"id":"1f72eec0e57842de","repo":"crewAIInc/crewAI","slug":"the-tavily-python-package-is-required-click-a","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., 'uv add 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\\., 'uv add 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_extractor_tool/tavily_extractor_tool.py","lineNumber":102,"sourceCode":"\n        Args:\n            **kwargs: Additional keyword arguments.\n        \"\"\"\n        super().__init__(**kwargs)\n        if TAVILY_AVAILABLE:\n            self.client = TavilyClient(\n                api_key=self.api_key, proxies=self.proxies, client_name=\"crewai\"\n            )\n            self.async_client = AsyncTavilyClient(\n                api_key=self.api_key, proxies=self.proxies, client_name=\"crewai\"\n            )\n        else:\n            try:\n                import subprocess\n\n                import click\n            except ImportError:\n                raise ImportError(\n                    \"The 'tavily-python' package is required. 'click' and 'subprocess' are also needed to assist with installation if the package is missing. \"\n                    \"Please install 'tavily-python' manually (e.g., 'uv add tavily-python') and ensure 'click' and 'subprocess' are available.\"\n                ) from None\n\n            if click.confirm(\n                \"You are missing the 'tavily-python' package, which is required for TavilyExtractorTool. Would you like to install it?\"\n            ):\n                try:\n                    subprocess.run([\"uv pip\", \"install\", \"tavily-python\"], check=True)  # noqa: S607\n                    raise ImportError(\n                        \"'tavily-python' has been installed. Please restart your Python application to use the TavilyExtractorTool.\"\n                    )\n                except subprocess.CalledProcessError as e:\n                    raise ImportError(\n                        f\"Attempted to install 'tavily-python' but failed: {e}. \"\n                        f\"Please install it manually to use the TavilyExtractorTool.\"\n                    ) from e\n            else:","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/tavily_extractor_tool/tavily_extractor_tool.py#L84-L120","documentation":"TavilyExtractorTool raises this ImportError during __init__ when 'tavily-python' is absent AND the fallback installer helpers ('click' and 'subprocess' modules) also cannot be imported. The interactive install prompt is never reached because the helper imports fail first. Note the message is slightly misleading: 'subprocess' is stdlib, so in practice this fires when click is missing or imports are blocked.","triggerScenarios":"Instantiating TavilyExtractorTool in an environment where TAVILY_AVAILABLE is False and either click is not installed or an import hook/permission blocks importing click or subprocess (e.g. restricted sandbox, broken sys.path).","commonSituations":"Installing crewai-tools without the tavily extra and also lacking click (rare, since click is a near-universal transitive dep); running under a locked-down environment that forbids subprocess; a corrupted venv where stdlib paths are broken.","solutions":["Install the dependency directly: uv add tavily-python (or pip install tavily-python), then recreate the tool.","Ensure click is installed: uv add click.","If in a sandbox that blocks subprocess, run in an environment that allows it, or pre-install tavily-python so the fallback path is never taken."],"exampleFix":"# before\ntool = TavilyExtractorTool()  # -> ImportError about tavily-python/click/subprocess\n\n# after\n# shell: uv add tavily-python click\ntool = TavilyExtractorTool()","handlingStrategy":"try-catch","validationCode":"import importlib.util\n\nTAVILY_READY = importlib.util.find_spec(\"tavily\") is not None and importlib.util.find_spec(\"click\") is not None\nif not TAVILY_READY:\n    raise SystemExit(\"Install first: uv add tavily-python click\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = TavilyExtractorTool(api_key=...)\nexcept ImportError as e:\n    raise SystemExit(f\"Missing dependency: {e}. Run: uv add tavily-python click\") from e","preventionTips":["Declare tavily-python (and click) in project dependencies instead of relying on runtime auto-install.","For non-interactive environments, never depend on click.confirm prompts; pre-install everything.","Wrap Tavily tool construction in a startup check that verifies importability."],"tags":["tavily","dependency","import-error","crewai-tools","installation"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}