{"record":{"id":"a75b8d1acdf008e6","repo":"crewAIInc/crewAI","slug":"scrapegraph-py-package-not-found-please-run-uv","errorCode":null,"errorMessage":"`scrapegraph-py` package not found, please run `uv add scrapegraph-py`","messagePattern":"`scrapegraph-py` package not found, please run `uv add scrapegraph-py`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/scrapegraph_scrape_tool/scrapegraph_scrape_tool.py","lineNumber":109,"sourceCode":"                sgai_logger,\n            )\n\n        except ImportError:\n            import click\n\n            if click.confirm(\n                \"You are missing the 'scrapegraph-py' package. Would you like to install it?\"\n            ):\n                import subprocess\n\n                subprocess.run([\"uv\", \"add\", \"scrapegraph-py\"], check=True)  # noqa: S607\n                from scrapegraph_py import Client  # type: ignore[import-untyped]\n                from scrapegraph_py.logger import (  # type: ignore[import-untyped]\n                    sgai_logger,\n                )\n\n            else:\n                raise ImportError(\n                    \"`scrapegraph-py` package not found, please run `uv add scrapegraph-py`\"\n                ) from None\n\n        self.api_key = api_key or os.getenv(\"SCRAPEGRAPH_API_KEY\")\n        self._client = Client(api_key=self.api_key)\n\n        if not self.api_key:\n            raise ValueError(\"Scrapegraph API key is required\")\n\n        if website_url is not None:\n            self._validate_url(website_url)\n            self.website_url = website_url\n            self.description = f\"A tool that uses Scrapegraph AI to intelligently scrape {website_url}'s content.\"\n            self.args_schema = FixedScrapegraphScrapeToolSchema\n\n        if user_prompt is not None:\n            self.user_prompt = user_prompt\n","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/scrapegraph_scrape_tool/scrapegraph_scrape_tool.py#L91-L127","documentation":"Raised by ScrapegraphScrapeTool's constructor when scrapegraph_py is not importable and the user declines the interactive `uv add scrapegraph-py` offer. The prompt branch runs subprocess uv add on acceptance; on refusal this ImportError (with suppressed context) tells you the exact install command to run yourself.","triggerScenarios":"Constructing ScrapegraphScrapeTool in an environment without scrapegraph-py installed and answering 'n' to the click.confirm prompt — including non-interactive shells where confirm cannot return True.","commonSituations":"CI/docker runs with piped stdin where the prompt aborts; developers declining auto-install to control dependency versions; uv-based projects where the user prefers manual dependency management.","solutions":["Install the package: uv add scrapegraph-py (or pip install scrapegraph-py) in the active environment","Verify installation went to the same interpreter the tool runs under","Pre-install in CI/Docker images so the prompt is never reached","For scripted runs, pre-install rather than relying on interactive consent"],"exampleFix":"# before\n$ python agent.py\n# > You are missing the 'scrapegraph-py' package. Would you like to install it? n\n# ImportError\n\n# after\n$ uv add scrapegraph-py\n$ python agent.py\n","handlingStrategy":"validation","validationCode":"import importlib.util, shutil\n\ndef scrapegraph_ready() -> bool:\n    return importlib.util.find_spec(\"scrapegraph_py\") is not None or shutil.which(\"uv\") is not None\n\nassert scrapegraph_ready(), \"Install first: uv add scrapegraph-py\"","typeGuard":null,"tryCatchPattern":"try:\n    tool = ScrapegraphScrapeTool(api_key=key)\nexcept ImportError as e:\n    raise SystemExit(f\"Missing dependency: {e}\") from e","preventionTips":["Pre-install scrapegraph-py in all environments and CI images","Never depend on the interactive click.confirm path in automation","Ensure uv is installed and on PATH if you expect the auto-install offer to work","Check find_spec('scrapegraph_py') during startup smoke tests"],"tags":["installation","dependencies","interactive-prompt","scrapegraph"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}