crewAIInc/crewAI · error · ImportError

Failed to install firecrawl-py package

Error message

Failed to install firecrawl-py package

What it means

Raised by FirecrawlSearchTool.__init__ when the user accepted the interactive install prompt but 'uv add firecrawl-py' exited non-zero. The original CalledProcessError is attached as __cause__, preserving the underlying install failure (no uv binary, network issue, resolver conflict).

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/firecrawl_search_tool/firecrawl_search_tool.py:100

        try:
            from firecrawl import FirecrawlApp

            self._firecrawl = FirecrawlApp(api_key=self.api_key)
        except ImportError:
            import click

            if click.confirm(
                "You are missing the 'firecrawl-py' package. Would you like to install it?"
            ):
                import subprocess

                try:
                    subprocess.run(["uv", "add", "firecrawl-py"], check=True)  # noqa: S607
                    from firecrawl import FirecrawlApp

                    self._firecrawl = FirecrawlApp(api_key=self.api_key)
                except subprocess.CalledProcessError as e:
                    raise ImportError("Failed to install firecrawl-py package") from e
            else:
                raise ImportError(
                    "`firecrawl-py` package not found, please run `uv add firecrawl-py`"
                ) from None

    def _run(
        self,
        query: str,
    ) -> Any:
        if not self._firecrawl:
            raise RuntimeError("FirecrawlApp not properly initialized")

        return self._firecrawl.search(
            query=query,
            **self.config,
        )

View on GitHub (pinned to 754d7323be)

Solutions

  1. Run pip install firecrawl-py in your shell to install directly and see any real resolver errors.
  2. Ensure uv exists and works: uv --version; install uv if absent.
  3. Inspect exc.__cause__ for the exact subprocess failure and address that (proxy, network, pins).

Example fix

# before: prompt accepted, uv fails -> ImportError
# after: shell
#   pip install firecrawl-py
tool = FirecrawlSearchTool(api_key=FIRECRAWL_API_KEY)
Defensive patterns

Strategy: try-catch

Validate before calling

import shutil, subprocess
if not shutil.which('uv'):
    print('uv not found; installing firecrawl-py via pip instead')
    subprocess.run([sys.executable, '-m', 'pip', 'install', 'firecrawl-py'], check=True)

Try / catch

try:
    tool = FirecrawlSearchTool(api_key=KEY)
except ImportError as e:
    cause = e.__cause__
    if isinstance(cause, subprocess.CalledProcessError):
        logger.error('uv install failed rc=%s; falling back to pip', cause.returncode)
        subprocess.run([sys.executable, '-m', 'pip', 'install', 'firecrawl-py'], check=True)
    raise

Prevention

When it happens

Trigger: Answering 'y' to the prompt on a machine without uv installed, offline, or with a dependency conflict that makes uv fail to resolve firecrawl-py.

Common situations: Slim Docker images and CI runners lacking uv; corporate proxies blocking package registries; version pin conflicts in existing lockfiles.

Related errors


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