{"record":{"id":"120b266a04d3297f","repo":"crewAIInc/crewAI","slug":"failed-to-install-firecrawl-py-package-120b26","errorCode":null,"errorMessage":"Failed to install firecrawl-py package","messagePattern":"Failed to install firecrawl-py package","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/firecrawl_search_tool/firecrawl_search_tool.py","lineNumber":100,"sourceCode":"        try:\n            from firecrawl import FirecrawlApp\n\n            self._firecrawl = FirecrawlApp(api_key=self.api_key)\n        except ImportError:\n            import click\n\n            if click.confirm(\n                \"You are missing the 'firecrawl-py' package. Would you like to install it?\"\n            ):\n                import subprocess\n\n                try:\n                    subprocess.run([\"uv\", \"add\", \"firecrawl-py\"], check=True)  # noqa: S607\n                    from firecrawl import FirecrawlApp\n\n                    self._firecrawl = FirecrawlApp(api_key=self.api_key)\n                except subprocess.CalledProcessError as e:\n                    raise ImportError(\"Failed to install firecrawl-py package\") from e\n            else:\n                raise ImportError(\n                    \"`firecrawl-py` package not found, please run `uv add firecrawl-py`\"\n                ) from None\n\n    def _run(\n        self,\n        query: str,\n    ) -> Any:\n        if not self._firecrawl:\n            raise RuntimeError(\"FirecrawlApp not properly initialized\")\n\n        return self._firecrawl.search(\n            query=query,\n            **self.config,\n        )\n\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/firecrawl_search_tool/firecrawl_search_tool.py#L82-L118","documentation":"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).","triggerScenarios":"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.","commonSituations":"Slim Docker images and CI runners lacking uv; corporate proxies blocking package registries; version pin conflicts in existing lockfiles.","solutions":["Run pip install firecrawl-py in your shell to install directly and see any real resolver errors.","Ensure uv exists and works: uv --version; install uv if absent.","Inspect exc.__cause__ for the exact subprocess failure and address that (proxy, network, pins)."],"exampleFix":"# before: prompt accepted, uv fails -> ImportError\n# after: shell\n#   pip install firecrawl-py\ntool = FirecrawlSearchTool(api_key=FIRECRAWL_API_KEY)","handlingStrategy":"try-catch","validationCode":"import shutil, subprocess\nif not shutil.which('uv'):\n    print('uv not found; installing firecrawl-py via pip instead')\n    subprocess.run([sys.executable, '-m', 'pip', 'install', 'firecrawl-py'], check=True)","typeGuard":null,"tryCatchPattern":"try:\n    tool = FirecrawlSearchTool(api_key=KEY)\nexcept ImportError as e:\n    cause = e.__cause__\n    if isinstance(cause, subprocess.CalledProcessError):\n        logger.error('uv install failed rc=%s; falling back to pip', cause.returncode)\n        subprocess.run([sys.executable, '-m', 'pip', 'install', 'firecrawl-py'], check=True)\n    raise","preventionTips":["Verify uv is on PATH before relying on interactive installs.","Inspect __cause__ on the ImportError to find the true install failure."],"tags":["firecrawl","dependency","subprocess","install-failure","optional-deps"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}