{"record":{"id":"26f81abd9bc91158","repo":"crewAIInc/crewAI","slug":"failed-to-install-oxylabs-package-26f81a","errorCode":null,"errorMessage":"Failed to install oxylabs package","messagePattern":"Failed to install oxylabs package","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/oxylabs_amazon_search_scraper_tool/oxylabs_amazon_search_scraper_tool.py","lineNumber":137,"sourceCode":"        else:\n            import click\n\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 = OxylabsAmazonSearchScraperConfig()\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","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/oxylabs_amazon_search_scraper_tool/oxylabs_amazon_search_scraper_tool.py#L119-L155","documentation":"Same auto-install flow as the product scraper, but in OxylabsAmazonSearchScraperTool.__init__: oxylabs missing, user accepts the prompt, `uv add oxylabs` subprocess fails (CalledProcessError), and the ImportError 'Failed to install oxylabs package' is raised with the subprocess error as __cause__.","triggerScenarios":"Constructing OxylabsAmazonSearchScraperTool without oxylabs installed, confirming the install, while `uv add oxylabs` fails — no uv project in the working directory, uv absent, network/proxy failure, or resolver conflict.","commonSituations":"Non-uv projects (pip/requirements.txt) where `uv add` cannot work; CI containers lacking a pyproject.toml; air-gapped networks.","solutions":["Install oxylabs directly: pip install oxylabs (or uv add oxylabs from the project root of a uv project).","Inspect the chained __cause__ to see uv's real failure output.","Pre-install oxylabs in deployment images to skip the interactive path entirely."],"exampleFix":"# before: subprocess.run(['uv','add','oxylabs']) fails outside a uv project\n\n# after: install with the tool you actually use\npip install oxylabs","handlingStrategy":"try-catch","validationCode":"try:\n    import oxylabs  # noqa: F401\nexcept ImportError:\n    raise SystemExit(\"Run `pip install oxylabs` (or `uv add oxylabs` in a uv project) first\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = OxylabsAmazonSearchScraperTool(username=u, password=p)\nexcept ImportError as e:\n    raise SystemExit(f\"Install oxylabs manually: {e}\") from e","preventionTips":["Pre-install oxylabs; do not depend on runtime `uv add` in deployment.","Use `uv add` only from the root of a uv-managed project.","Cache wheels / use a corporate PyPI mirror if the network blocks installs."],"tags":["oxylabs","dependency","uv","install","scraping"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}