ModuleNotFoundError: langchain_community.chat_models.vertexai (breaks import ragas)
Importing ragas fails on a fresh install. ragas/llms/base.py imports ChatVertexAI from langchain_community.chat_models.vertexai, and that module doesn't exist in any current langchain-community release.
Repro
python3 -m venv /tmp/repro && source /tmp/repro/bin/activate
pip install ragas langchain-community
python3 -c "import ragas"Traceback
Traceback (most recent call last):
File ".../ragas/__init__.py", line 5, in <module>
from ragas.evaluation import aevaluate, evaluate
File ".../ragas/evaluation.py", line 31, in <module>
from ragas.llms import llm_factory
File ".../ragas/llms/__init__.py", line 1, in <module>
from ragas.llms.base import (...)
File ".../ragas/llms/base.py", line 12, in <module>
from langchain_community.chat_models.vertexai import ChatVertexAI
ModuleNotFoundError: No module named 'langchain_community.chat_models.vertexai'Versions
ragas 0.4.3 (latest on PyPI), langchain-community 0.4.2, langchain-core 1.6.1.
What I checked
I downloaded the langchain-community wheels for 0.4.2, 0.4.0, 0.3.27, and 0.3.20 and inspected their contents directly. None contain langchain_community/chat_models/vertexai.py. They do contain llms/vertexai.py, embeddings/vertexai.py, and utilities/vertexai.py, just not a chat_models/vertexai.py.
I originally planned to file this against langchain-community itself, but that package's dedicated repo (langchain-ai/langchain-community) was archived on 2026-06-19 and is no longer maintained, so it isn't a workable place to report it. ChatVertexAI now lives in langchain_google_vertexai.chat_models (libs/vertexai/langchain_google_vertexai/chat_models.py in langchain-ai/langchain-google), meaning the class moved into its own partner package at some point. Ragas's import doesn't reflect that move. The same broken import is still on main today, so this isn't fixed in an unreleased version either.
Ask
Should this import switch to langchain_google_vertexai, ideally as a lazy or optional import so people without Vertex AI installed aren't forced into the dependency? Or is there a different fix you'd prefer?
Source: vibrantlabsai/ragas