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 OxylabsAmazonSearchScraperTool.__init__ when the oxylabs package is not importable and the user declines (or cannot answer) the click.confirm install prompt. The message tells you to install it with `uv add oxylabs`.

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/oxylabs_amazon_search_scraper_tool/oxylabs_amazon_search_scraper_tool.py:139

            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 = OxylabsAmazonSearchScraperConfig()
        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, query: str) -> str:

View on GitHub (pinned to 754d7323be)

Solutions

  1. pip install oxylabs (or uv add oxylabs in a uv project) before constructing the tool.
  2. Pin oxylabs in your dependency manifest so environments are reproducible.
  3. Quick check: python -c "import oxylabs".

Example fix

# before
tool = OxylabsAmazonSearchScraperTool()  # ImportError

# after
# pip install oxylabs
tool = OxylabsAmazonSearchScraperTool(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 = OxylabsAmazonSearchScraperTool(username=u, password=p)
except ImportError as e:
    raise SystemExit("pip install oxylabs, then retry") from e

Prevention

When it happens

Trigger: OxylabsAmazonSearchScraperTool(...) without oxylabs installed; prompt answered 'no' or stdin is closed (EOF) in a non-interactive process.

Common situations: Headless CI/cron runs where click.confirm aborts; intentional refusal to let a library mutate dependencies at runtime.

Related errors


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