HKUDS/Vibe-Trading · critical · RuntimeError
langchain-openai is not installed
Error message
langchain-openai is not installed
What it means
The generic OpenAI-compatible path in build_llm needs ChatOpenAI from langchain-openai, but the module import failed (symbol is None). This is the core dependency of the library's LLM stack, so no fallback exists.
Source
Thrown at agent/src/providers/llm.py:1458
)
if provider == "deepseek":
adapter_mode = _deepseek_adapter_mode()
if adapter_mode != "openai-compatible":
native_llm = _build_native_deepseek(
model=name,
temperature=temperature,
callbacks=callbacks,
)
if native_llm is not None:
return native_llm
if adapter_mode == "native":
raise RuntimeError(
"VIBE_TRADING_DEEPSEEK_ADAPTER=native requires langchain-deepseek"
)
if ChatOpenAI is None:
raise RuntimeError("langchain-openai is not installed")
# MiniMax requires temperature in (0.0, 1.0] — clamp to 0.01 when the
# default 0.0 is used to avoid an API validation error.
if provider == "minimax" and temperature <= 0.0:
temperature = 0.01
# Kimi reasoning models reject any temperature other than 1
# ("invalid temperature: only 1 is allowed for this model").
if (
caps.name in {"moonshot", "kimi-coding"}
and _KIMI_FORCED_TEMPERATURE_RE.match(name)
and temperature != 1.0
):
logger.info("Forcing temperature=1.0 for %s (provider requirement)", name)
temperature = 1.0
effort = get_env_config().llm.langchain_reasoning_effort.strip().lower()
# Moonshot/DeepSeek official APIs emit reasoning by default and ignore this field.
configured_responses_api = get_env_config().llm.langchain_use_responses_api
use_responses_api = uses_responses_api(provider, configured_responses_api)
creds = get_llm_credentials(provider, name)View on GitHub (pinned to 80ffdda44c)
Solutions
- Install/repair: pip install langchain-openai
- If already installed, diagnose the underlying import failure: python -c "from langchain_openai import ChatOpenAI" and fix the reported version conflict (often reinstall langchain-core to matching version)
- Recreate the virtualenv if dependency resolution is beyond repair
Example fix
# before RuntimeError: langchain-openai is not installed # after pip install -U langchain-openai langchain-core
Defensive patterns
Strategy: validation
Validate before calling
try:
from langchain_openai import ChatOpenAI # noqa: F401
except ImportError as e:
raise SystemExit(f'Dependency check failed: {e}') Try / catch
try:
llm = build_llm()
except RuntimeError as e:
if 'langchain-openai' in str(e):
logging.exception('install langchain-openai and restart'); raise Prevention
- Pin langchain-openai/langchain-core to compatible versions
- Add an import smoke test to CI for the core LLM stack
When it happens
Trigger: Any build_llm call for an OpenAI-compatible provider (openai, minimax, kimi, deepseek fallback, etc.) when langchain-openai is missing or its import raised.
Common situations: Broken virtualenv after dependency upgrades; langchain/openai package version conflict causing ImportError at module load; slim production image built without the agent extras.
Related errors
- Anthropic provider requires langchain-anthropic. Install the
- VIBE_TRADING_DEEPSEEK_ADAPTER=native requires langchain-deep
- oauth-cli-kit is not installed. Run: pip install oauth-cli-k
- OpenAI Codex OAuth requires httpx. Install dependencies firs
- {source} produces a non-ASCII HTTP header ({name!r}). Use an
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/c262474f9ab16a07.
Report an issue: GitHub.