{"record":{"id":"7612f44089ba438a","repo":"crewAIInc/crewAI","slug":"failed-to-install-oxylabs-package-7612f4","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_universal_scraper_tool/oxylabs_universal_scraper_tool.py","lineNumber":131,"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 = OxylabsUniversalScraperConfig()\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":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/oxylabs_universal_scraper_tool/oxylabs_universal_scraper_tool.py#L113-L149","documentation":"The universal scraper variant of the same flow: oxylabs not importable, user accepts the click.confirm install prompt, `subprocess.run(['uv','add','oxylabs'])` exits non-zero, and OxylabsUniversalScraperTool.__init__ raises ImportError('Failed to install oxylabs package') chained to the CalledProcessError.","triggerScenarios":"Constructing OxylabsUniversalScraperTool without oxylabs, confirming the prompt, in a directory with no uv project (or with uv missing/offline) so `uv add oxylabs` fails.","commonSituations":"pip-based projects where `uv add` is invalid; CI images without uv; restricted networks blocking PyPI.","solutions":["Install manually: pip install oxylabs (or uv add oxylabs from a uv project root).","Read e.__cause__ / run `uv add oxylabs` yourself to see the true failure reason.","Bake oxylabs into container images to avoid the interactive installer entirely."],"exampleFix":"# before: auto uv add fails in pip project\n\n# after\npip install oxylabs","handlingStrategy":"try-catch","validationCode":"try:\n    import oxylabs  # noqa: F401\nexcept ImportError:\n    raise SystemExit(\"pip install oxylabs before using OxylabsUniversalScraperTool\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = OxylabsUniversalScraperTool(username=u, password=p)\nexcept ImportError as e:\n    raise SystemExit(f\"Install oxylabs manually (pip install oxylabs): underlying {e.__cause__}\") from e","preventionTips":["Preinstall oxylabs; treat the auto-installer as a dev-only convenience.","Run `uv add` from the project root if you rely on uv."],"tags":["oxylabs","dependency","uv","install","scraping"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}