{"record":{"id":"f5da0b3d798218da","repo":"crewAIInc/crewAI","slug":"tavily-python-has-been-installed-please-restart","errorCode":null,"errorMessage":"'tavily-python' has been installed. Please restart your Python application to use the TavilyExtractorTool.","messagePattern":"'tavily-python' has been installed\\. Please restart your Python application to use the TavilyExtractorTool\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"warning","filePath":"lib/crewai-tools/src/crewai_tools/tools/tavily_extractor_tool/tavily_extractor_tool.py","lineNumber":112,"sourceCode":"                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:\n                raise ImportError(\n                    \"The 'tavily-python' package is required to use the TavilyExtractorTool. \"\n                    \"Please install it with: uv add tavily-python\"\n                )\n\n    def _run(\n        self,\n        urls: list[str] | str,\n    ) -> str:\n        \"\"\"Synchronously extracts content from the given URL(s).","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/tavily_extractor_tool/tavily_extractor_tool.py#L94-L130","documentation":"This ImportError is raised deliberately AFTER a successful interactive install of tavily-python (subprocess.run(..., check=True) returned 0). Because the package was installed into site-packages after the Python process started, the already-imported (failed) module state cannot be reused safely, so the tool tells you to restart. It is control flow via exception, not a real failure.","triggerScenarios":"TavilyExtractorTool.__init__ with tavily-python missing, click.confirm(...) answered 'y', and subprocess.run([\"uv pip\", \"install\", \"tavily-python\"]) exiting 0. Note the argv is malformed (\"uv pip\" as a single token), so on most systems this branch is unreachable and you get FileNotFoundError instead.","commonSituations":"First-run onboarding flows where the user accepts the install prompt in an interactive session; CI jobs that accidentally answer prompts via piped stdin.","solutions":["Restart the Python application/process so the freshly installed tavily-python is importable, then construct TavilyExtractorTool again.","Prefer installing up front (uv add tavily-python) so no prompt/restart cycle is needed.","If you hit FileNotFoundError instead, that is the broken [\"uv pip\", ...] argv in the extractor tool; install manually with pip/uv and report the bug upstream."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import importlib.util\nif importlib.util.find_spec(\"tavily\") is None:\n    raise SystemExit(\"tavily-python missing; install and start the app with it present\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = TavilyExtractorTool()\nexcept ImportError as e:\n    if \"has been installed\" in str(e):\n        print(\"Dependency installed; restarting process...\")\n        os.execv(sys.executable, [sys.executable, *sys.argv])  # clean restart\n    else:\n        raise","preventionTips":["Pre-install tavily-python so the prompt/restart cycle never triggers.","Treat 'has been installed. Please restart' as a success signal in wrappers, and re-exec the process.","Avoid interactive dependency installs in production code paths."],"tags":["tavily","installation","restart-required","import-error","crewai-tools"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}