{"record":{"id":"188cf5b658aab332","repo":"crewAIInc/crewAI","slug":"oxylabs-package-not-found-please-run-uv-add-ox","errorCode":null,"errorMessage":"`oxylabs` package not found, please run `uv add oxylabs`","messagePattern":"`oxylabs` package not found, please run `uv add oxylabs`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/oxylabs_amazon_product_scraper_tool/oxylabs_amazon_product_scraper_tool.py","lineNumber":137,"sourceCode":"\n            if click.confirm(\n                \"You are missing the 'oxylabs' package. Would you like to install it?\"\n            ):\n                import subprocess\n\n                try:\n                    subprocess.run([\"uv\", \"add\", \"oxylabs\"], check=True)  # noqa: S607\n                    from oxylabs import RealtimeClient\n\n                    kwargs[\"oxylabs_api\"] = RealtimeClient(\n                        username=username,\n                        password=password,\n                        sdk_type=sdk_type,\n                    )\n                except subprocess.CalledProcessError as e:\n                    raise ImportError(\"Failed to install oxylabs package\") from e\n            else:\n                raise ImportError(\n                    \"`oxylabs` package not found, please run `uv add oxylabs`\"\n                )\n\n        if config is None:\n            config = OxylabsAmazonProductScraperConfig()\n        super().__init__(config=config, **kwargs)\n\n    def _get_credentials_from_env(self) -> tuple[str, str]:\n        username = os.environ.get(\"OXYLABS_USERNAME\")\n        password = os.environ.get(\"OXYLABS_PASSWORD\")\n        if not username or not password:\n            raise ValueError(\n                \"You must pass oxylabs username and password when instantiating the tool \"\n                \"or specify OXYLABS_USERNAME and OXYLABS_PASSWORD environment variables\"\n            )\n        return username, password\n\n    def _run(self, query: str) -> str:","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/oxylabs_amazon_product_scraper_tool/oxylabs_amazon_product_scraper_tool.py#L119-L155","documentation":"When the oxylabs SDK is not importable and the user declines the interactive install prompt (click.confirm returns False), OxylabsAmazonProductScraperTool.__init__ raises ImportError instructing you to run `uv add oxylabs`. It is the explicit 'dependency missing, user said no' path.","triggerScenarios":"Instantiating OxylabsAmazonProductScraperTool without oxylabs installed and answering 'n' to 'Would you like to install it?', or running non-interactively where click.confirm reads EOF/defaults to no.","commonSituations":"CI pipelines and cron jobs with no TTY (the prompt cannot be answered, effectively declining); developers declining the prompt to control dependencies manually.","solutions":["Install the dependency yourself: uv add oxylabs (uv projects) or pip install oxylabs.","For non-interactive deployments, always pre-install oxylabs so this branch is never reached.","Verify with python -c \"import oxylabs\" before constructing the tool."],"exampleFix":"# before\ntool = OxylabsAmazonProductScraperTool()  # prompt declined -> ImportError\n\n# after\n# pip install oxylabs\ntool = OxylabsAmazonProductScraperTool()","handlingStrategy":"validation","validationCode":"try:\n    import oxylabs  # noqa: F401\n    HAS_OXYLABS = True\nexcept ImportError:\n    HAS_OXYLABS = False\n\nif not HAS_OXYLABS:\n    raise SystemExit(\"Dependency missing: run `pip install oxylabs` (or `uv add oxylabs`) before building agents\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = OxylabsAmazonProductScraperTool(username=u, password=p)\nexcept ImportError as e:\n    if \"oxylabs\" in str(e):\n        subprocess.run([sys.executable, \"-m\", \"pip\", \"install\", \"oxylabs\"], check=True)\n        tool = OxylabsAmazonProductScraperTool(username=u, password=p)","preventionTips":["Add oxylabs to requirements/pyproject so it is always present.","Avoid interactive dependency prompts in non-interactive deployments.","Test imports in CI before running agent suites."],"tags":["oxylabs","dependency","import-error","scraping"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}