crewAIInc/crewAI · error · ImportError
You are missing the 'weaviate-client' package. Would you lik
Error message
You are missing the 'weaviate-client' package. Would you like to install it?
What it means
When the optional 'weaviate-client' package is not importable, WeaviateVectorSearchTool's __init__ interactively asks to install it. If you decline (click.confirm False), it raises ImportError whose text is the question itself - a known copy/paste artifact of the interactive path.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/weaviate_tool/vector_search.py:102
)
def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
if WEAVIATE_AVAILABLE:
openai_api_key = os.environ.get("OPENAI_API_KEY")
if not openai_api_key:
raise ValueError(
"OPENAI_API_KEY environment variable is required for WeaviateVectorSearchTool and it is mandatory to use the tool."
)
self.headers = {"X-OpenAI-Api-Key": openai_api_key}
else:
if click.confirm(
"You are missing the 'weaviate-client' package. Would you like to install it?"
):
subprocess.run(["uv", "pip", "install", "weaviate-client"], check=True) # noqa: S607
else:
raise ImportError(
"You are missing the 'weaviate-client' package. Would you like to install it?"
)
def _run(self, query: str) -> str:
if not WEAVIATE_AVAILABLE:
raise ImportError(
"You are missing the 'weaviate-client' package. Would you like to install it?"
)
if not self.weaviate_cluster_url or not self.weaviate_api_key:
raise ValueError("WEAVIATE_URL or WEAVIATE_API_KEY is not set")
client = weaviate.connect_to_weaviate_cloud(
cluster_url=self.weaviate_cluster_url,
auth_credentials=Auth.api_key(self.weaviate_api_key),
headers=self.headers,
)
internal_docs = client.collections.get(self.collection_name)View on GitHub (pinned to 754d7323be)
Solutions
- Install the package: uv pip install weaviate-client (or pip install weaviate-client) before running.
- Add weaviate-client to project dependencies so the prompt never triggers.
- For deployments, never rely on interactive install - bake deps into the image.
Example fix
# before
WeaviateVectorSearchTool(...) # non-interactive -> prompt declined -> ImportError
# after
# shell: pip install weaviate-client
# plus: export OPENAI_API_KEY=...
WeaviateVectorSearchTool(
weaviate_cluster_url='https://...', weaviate_api_key='...'
) Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
if not importlib.util.find_spec('weaviate'):
raise SystemExit('weaviate-client missing: pip install weaviate-client') Try / catch
try:
tool = WeaviateVectorSearchTool(
weaviate_cluster_url=URL, weaviate_api_key=WKEY
)
except ImportError as e:
raise SystemExit(f'Install weaviate-client and restart: {e}') Prevention
- Pre-install weaviate-client in the image; never depend on interactive prompts.
- Check find_spec('weaviate') at startup alongside env var checks.
- Run crews non-interactively (stdin closed) so prompts fail loudly, not silently.
When it happens
Trigger: Constructing WeaviateVectorSearchTool in an environment without weaviate-client and answering 'n' to the prompt, or running non-interactively (stdin closed/EOF) so click.confirm declines by default.
Common situations: Automated scripts/CI where no one can answer the prompt; minimal crewai-tools installs; piping input that yields a non-'y' first char.
Related errors
- `patronus` package not found, please run `uv add patronus`
- `scrapegraph-py` package not found, please run `uv add scrap
- `minds_sdk` package not found, please run `pip install minds
- Could not import langchain_apify python package. Please inst
- Failed to install 'patronus' package
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/e1007b86985b4a6a.
Report an issue: GitHub.