crewAIInc/crewAI · error · ImportError

Snowflake dependencies not found. Please install them by run

Error message

Snowflake dependencies not found. Please install them by running `uv add cryptography snowflake-connector-python snowflake-sqlalchemy`

What it means

SnowflakeSearchTool raises this ImportError when the Snowflake packages (cryptography, snowflake-connector-python, snowflake-sqlalchemy) are missing and the user declines the interactive install prompt. It is the explicit opt-out branch and includes the exact install command in the message.

Source

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

                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
        )

    def _create_connection(self) -> SnowflakeConnection:

View on GitHub (pinned to 754d7323be)

Solutions

  1. Install the extras yourself: uv add cryptography snowflake-connector-python snowflake-sqlalchemy, or pip install the same packages.
  2. Add the packages to your requirements/Dockerfile so instantiation never reaches the prompt.
  3. For automated environments, pre-install dependencies — the prompt only appears on ImportError.

Example fix

Dockerfile:
# before
RUN pip install crewai-tools

# after
RUN pip install crewai-tools snowflake-connector-python snowflake-sqlalchemy cryptography
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util
for mod in ("snowflake", "snowflake.sqlalchemy", "cryptography"):
    if importlib.util.find_spec(mod) is None:
        import subprocess
        subprocess.run(["pip", "install", mod.replace("sqlalchemy", "connector-python")], check=True)

Try / catch

try:
    tool = SnowflakeSearchTool(config=cfg)
except ImportError as e:
    if "Snowflake dependencies not found" in str(e):
        subprocess.run(["pip", "install", "snowflake-connector-python", "snowflake-sqlalchemy", "cryptography"], check=True)
        tool = SnowflakeSearchTool(config=cfg)

Prevention

When it happens

Trigger: Importing/instantiating SnowflakeSearchTool in an environment without the Snowflake deps and answering 'no' to the click.confirm prompt; or non-interactive shells where confirm defaults to declining.

Common situations: CI/CD and Docker runs where the prompt cannot be answered; users on pip-only projects who decline a uv-based install; slim images without optional extras installed.

Related errors


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