crewAIInc/crewAI · error · ImportError

Attempted to install 'tavily-python' but failed: {e}. Please

Error message

Attempted to install 'tavily-python' but failed: {e}. Please install it manually to use the TavilyExtractorTool.

What it means

Raised when the interactive install of tavily-python was accepted but subprocess.run raised CalledProcessError (non-zero exit). The underlying uv/pip command output is embedded in the message via {e}. In this specific tool the command is ["uv pip", "install", "tavily-python"] — "uv pip" as one token is not a valid executable, so you usually see FileNotFoundError (uncaught) rather than this error; CalledProcessError appears when a real installer command fails (no network, read-only env, no uv).

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/tavily_extractor_tool/tavily_extractor_tool.py:116

                import subprocess

                import click
            except ImportError:
                raise ImportError(
                    "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."
                ) from None

            if click.confirm(
                "You are missing the 'tavily-python' package, which is required for TavilyExtractorTool. Would you like to install it?"
            ):
                try:
                    subprocess.run(["uv pip", "install", "tavily-python"], check=True)  # noqa: S607
                    raise ImportError(
                        "'tavily-python' has been installed. Please restart your Python application to use the TavilyExtractorTool."
                    )
                except subprocess.CalledProcessError as e:
                    raise ImportError(
                        f"Attempted to install 'tavily-python' but failed: {e}. "
                        f"Please install it manually to use the TavilyExtractorTool."
                    ) from e
            else:
                raise ImportError(
                    "The 'tavily-python' package is required to use the TavilyExtractorTool. "
                    "Please install it with: uv add tavily-python"
                )

    def _run(
        self,
        urls: list[str] | str,
    ) -> str:
        """Synchronously extracts content from the given URL(s).

        Args:
            urls: The URL(s) to extract data from.

View on GitHub (pinned to 754d7323be)

Solutions

  1. Install manually with a working command: uv add tavily-python (or pip install tavily-python) in your shell, then re-create the tool.
  2. If behind a proxy, configure PIP_INDEX_URL/UV_INDEX_URL or proxy env vars and retry the manual install.
  3. If uv is missing, install it (curl -LsSf https://astral.sh/uv/install.sh | sh) or fall back to pip.
  4. Report the ["uv pip", ...] argv bug upstream so the auto-installer command is valid.

Example fix

# before (tool's internal, broken argv)
subprocess.run(["uv pip", "install", "tavily-python"], check=True)

# after
subprocess.run(["uv", "pip", "install", "tavily-python"], check=True)
Defensive patterns

Strategy: try-catch

Validate before calling

import shutil
if shutil.which("uv") is None and shutil.which("pip") is None:
    raise SystemExit("No installer available; pre-install tavily-python")

Try / catch

try:
    tool = TavilyExtractorTool()
except ImportError as e:
    if "Attempted to install 'tavily-python' but failed" in str(e):
        subprocess.run(["pip", "install", "tavily-python"], check=True)  # manual fallback
        raise SystemExit("Installed; restart the app") from e
    raise

Prevention

When it happens

Trigger: User answers 'y' to the install prompt and the installer subprocess exits non-zero: offline machine, uv not on PATH resolving correctly, permission-denied site-packages, or corporate proxy blocking PyPI.

Common situations: Air-gapped or proxied networks; containers running as non-root without write access to site-packages; CI runners without uv installed.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/1b6c1b9cb67b8851. Report an issue: GitHub.