crewAIInc/crewAI · error · ImportError

`oxylabs` package not found, please run `uv add oxylabs`

Error message

`oxylabs` package not found, please run `uv add oxylabs`

What it means

Raised by OxylabsUniversalScraperTool.__init__ when oxylabs is not installed and the click.confirm install prompt is declined (default in non-interactive contexts). The ImportError points you to `uv add oxylabs` as the manual install command.

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/oxylabs_universal_scraper_tool/oxylabs_universal_scraper_tool.py:133

            if click.confirm(
                "You are missing the 'oxylabs' package. Would you like to install it?"
            ):
                import subprocess

                try:
                    subprocess.run(["uv", "add", "oxylabs"], check=True)  # noqa: S607
                    from oxylabs import RealtimeClient

                    kwargs["oxylabs_api"] = RealtimeClient(
                        username=username,
                        password=password,
                        sdk_type=sdk_type,
                    )
                except subprocess.CalledProcessError as e:
                    raise ImportError("Failed to install oxylabs package") from e
            else:
                raise ImportError(
                    "`oxylabs` package not found, please run `uv add oxylabs`"
                )

        if config is None:
            config = OxylabsUniversalScraperConfig()
        super().__init__(config=config, **kwargs)

    def _get_credentials_from_env(self) -> tuple[str, str]:
        username = os.environ.get("OXYLABS_USERNAME")
        password = os.environ.get("OXYLABS_PASSWORD")
        if not username or not password:
            raise ValueError(
                "You must pass oxylabs username and password when instantiating the tool "
                "or specify OXYLABS_USERNAME and OXYLABS_PASSWORD environment variables"
            )
        return username, password

    def _run(self, url: str) -> str:

View on GitHub (pinned to 754d7323be)

Solutions

  1. Pre-install oxylabs: pip install oxylabs or uv add oxylabs.
  2. Add it to your dependency lock/requirements file.
  3. Confirm with python -c "import oxylabs" before building the agent.

Example fix

# before
tool = OxylabsUniversalScraperTool()  # ImportError

# after
# pip install oxylabs
tool = OxylabsUniversalScraperTool(username=u, password=p)
Defensive patterns

Strategy: validation

Validate before calling

try:
    import oxylabs  # noqa: F401
except ImportError:
    raise SystemExit("Dependency missing: pip install oxylabs")

Try / catch

try:
    tool = OxylabsUniversalScraperTool(username=u, password=p)
except ImportError as e:
    raise SystemExit("Install oxylabs, then retry") from e

Prevention

When it happens

Trigger: OxylabsUniversalScraperTool(...) with oxylabs absent and the prompt answered no, or stdin closed (EOF) in CI/Docker so confirmation fails/declines.

Common situations: Headless deployments where interactive prompts cannot be satisfied; deliberate refusal of runtime installs.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/19962010dbbeb426. Report an issue: GitHub.