crewAIInc/crewAI · error · ImportError
Failed to install oxylabs package
Error message
Failed to install oxylabs package
What it means
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__.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/oxylabs_amazon_search_scraper_tool/oxylabs_amazon_search_scraper_tool.py:137
else:
import click
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, passwordView on GitHub (pinned to 754d7323be)
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.
Example fix
# before: subprocess.run(['uv','add','oxylabs']) fails outside a uv project # after: install with the tool you actually use pip install oxylabs
Defensive patterns
Strategy: try-catch
Validate before calling
try:
import oxylabs # noqa: F401
except ImportError:
raise SystemExit("Run `pip install oxylabs` (or `uv add oxylabs` in a uv project) first") Try / catch
try:
tool = OxylabsAmazonSearchScraperTool(username=u, password=p)
except ImportError as e:
raise SystemExit(f"Install oxylabs manually: {e}") from e Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Non-uv projects (pip/requirements.txt) where `uv add` cannot work; CI containers lacking a pyproject.toml; air-gapped networks.
Related errors
- Failed to install oxylabs package
- Failed to install oxylabs package
- Failed to install oxylabs package
- `oxylabs` package not found, please run `uv add oxylabs`
- `oxylabs` package not found, please run `uv add oxylabs`
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/26f81abd9bc91158.
Report an issue: GitHub.