crewAIInc/crewAI · error · ImportError

Failed to install Snowflake dependencies

Error message

Failed to install Snowflake dependencies

What it means

SnowflakeSearchTool, like other crewai-tools, offers to install missing dependencies interactively (cryptography, snowflake-connector-python, snowflake-sqlalchemy) via `uv add`. This ImportError is raised when that subprocess fails (CalledProcessError chained via `from e`) — the install was attempted but the package manager returned non-zero.

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/snowflake_search_tool/snowflake_search_tool.py:153

                import subprocess

                try:
                    subprocess.run(
                        [  # noqa: S607
                            "uv",
                            "add",
                            "cryptography",
                            "snowflake-connector-python",
                            "snowflake-sqlalchemy",
                        ],
                        check=True,
                    )

                    self._connection_pool = []
                    self._pool_lock = threading.Lock()
                    self._thread_pool = ThreadPoolExecutor(max_workers=self.pool_size)
                except subprocess.CalledProcessError as e:
                    raise ImportError("Failed to install Snowflake dependencies") from e
            else:
                raise ImportError(
                    "Snowflake dependencies not found. Please install them by running "
                    "`uv add cryptography snowflake-connector-python snowflake-sqlalchemy`"
                ) from None

    async def _get_connection(self) -> SnowflakeConnection:
        """Get a connection from the pool or create a new one."""
        if self._pool_lock is None:
            raise RuntimeError("Pool lock not initialized")
        if self._connection_pool is None:
            raise RuntimeError("Connection pool not initialized")
        with self._pool_lock:
            if self._connection_pool:
                return self._connection_pool.pop()
        return await asyncio.get_event_loop().run_in_executor(
            self._thread_pool, self._create_connection
        )

View on GitHub (pinned to 754d7323be)

Solutions

  1. Install the dependencies directly: uv add cryptography snowflake-connector-python snowflake-sqlalchemy (or pip install snowflake-connector-python snowflake-sqlalchemy cryptography).
  2. Inspect the chained CalledProcessError output for the underlying cause (missing uv, resolver conflict, network failure) and fix that.
  3. Pin compatible versions if snowflake-connector-python cannot resolve for your Python version.

Example fix

# terminal
# before: tool instantiation triggers failed auto-install

# after:
#   pip install snowflake-connector-python snowflake-sqlalchemy cryptography
# then instantiate the tool
Defensive patterns

Strategy: try-catch

Validate before calling

import importlib.util
missing = [m for m in ("snowflake", "snowflake.sqlalchemy", "cryptography") if importlib.util.find_spec(m) is None]
if missing:
    raise RuntimeError(f"Missing Snowflake deps {missing}; run: pip install snowflake-connector-python snowflake-sqlalchemy cryptography")

Try / catch

try:
    tool = SnowflakeSearchTool(config=cfg)
except ImportError as e:
    raise RuntimeError(f"Install Snowflake deps before startup: {e}") from e

Prevention

When it happens

Trigger: Instantiating SnowflakeSearchTool without the Snowflake packages, confirming the click.prompt, while `uv` is unavailable/not on PATH, the directory is not a uv project, there is no network, or dependency resolution conflicts block the install.

Common situations: pip/conda environments without uv; CI containers lacking uv; Python version incompatibilities with snowflake-connector-python; offline or proxy-restricted networks.

Related errors


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