{"record":{"id":"231794c459dbeb52","repo":"crewAIInc/crewAI","slug":"failed-to-install-oxylabs-package","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_product_scraper_tool/oxylabs_amazon_product_scraper_tool.py","lineNumber":135,"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 = 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","sourceCodeStart":117,"sourceCodeEnd":153,"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#L117-L153","documentation":"In OxylabsAmazonProductScraperTool.__init__, when the oxylabs SDK is absent the tool interactively asks (click.confirm) whether to install it, then runs `uv add oxylabs` via subprocess. If that subprocess exits non-zero (CalledProcessError), an ImportError 'Failed to install oxylabs package' is raised chained to the underlying error.","triggerScenarios":"oxylabs not installed + user answers 'yes' to the install prompt + `uv add oxylabs` fails: uv not on PATH (FileNotFoundError surfaces differently), no uv project/pyproject in cwd, network failure, or a resolver/permission error.","commonSituations":"Running inside a non-uv project (uv add requires a project context); CI/containers where the prompt gets EOF or uv is missing; offline environments; read-only file systems.","solutions":["Install the SDK manually in your environment: uv add oxylabs (inside a uv project) or pip install oxylabs.","If not using uv, initialize a project (uv init) or switch the command to pip install oxylabs.","Check network access and proxy settings for PyPI; re-run the install command directly to see the real error.","Pre-install oxylabs in your Docker image so the interactive path is never hit."],"exampleFix":"# before: prompt-driven install fails in CI\n# (click.confirm -> uv add oxylabs -> CalledProcessError)\n\n# after: pre-install in Dockerfile\nRUN pip install oxylabs","handlingStrategy":"try-catch","validationCode":"def oxylabs_available() -> bool:\n    try:\n        import oxylabs  # noqa: F401\n        return True\n    except ImportError:\n        return False\n\nif not oxylabs_available():\n    raise SystemExit(\"Install first: pip install oxylabs\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = OxylabsAmazonProductScraperTool(username=u, password=p)\nexcept ImportError as e:\n    raise SystemExit(f\"oxylabs unavailable: {e}. Install with: pip install oxylabs\") from e","preventionTips":["Pre-install oxylabs in the environment/image; never rely on the interactive auto-installer in CI.","Run in a uv project if you expect `uv add` flows, otherwise use pip.","Check the __cause__ of the ImportError for uv's real failure output."],"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"}