You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No module named 'langchain_community.chat_models.vertexai' #2741
(base) (ragas_rel) PS E:\code\python-project\ragas_rel> uv run python main.py
Traceback (most recent call last):
File "E:\code\python-project\ragas_rel\main.py", line 5, in
from ragas.llms import llm_factory
File "E:\code\python-project\ragas_rel.venv\Lib\site-packages\ragas_init_.py", line 5, in
from ragas.evaluation import aevaluate, evaluate
File "E:\code\python-project\ragas_rel.venv\Lib\site-packages\ragas\evaluation.py", line 31, in
from ragas.llms import llm_factory
File "E:\code\python-project\ragas_rel.venv\Lib\site-packages\ragas\llms_init_.py", line 1, in
from ragas.llms.base import (
File "E:\code\python-project\ragas_rel.venv\Lib\site-packages\ragas\llms\base.py", line 12, in
from langchain_community.chat_models.vertexai import ChatVertexAI
ModuleNotFoundError: No module named 'langchain_community.chat_models.vertexai'
I’ve also just started using this library and ran into the same issues as you. I’m so disappointed with it that I probably won’t use it again in the future.
Once I finish running the documentation, I’m planning to switch to something else. It seems like a project called OpenEval might be better.
ChatVertexAI has been deprecated. You can switch to ChatGoogleGenerativeAI and GoogleGenerativeAI from the langchain_google_genai package instead.
I’ve opened a PR that updates these usages and adds the required dependency. Feel free to take a look, and let me know if you have any questions or run into issues 🙂
PR: #2739
I ran into this exact top-level crash today as well. I took a slightly different, more defensive approach in PR #2749.
Instead of switching underlying libraries or forcing a new mandatory cloud dependency onto core Ragas users who might not use Vertex AI, PR #2749 wraps the legacy imports in a try-except ImportError block and conditionally handles VERTEXAI_AVAILABLE.
This safely stops the hard crash for everyone on modern setups immediately, maintains absolute backward compatibility for legacy users, and keeps the core package lightweight. Would love to get your thoughts on this approach!
According to Claude, the chat_models.vertexai module was removed from langchain since version 1.0 .
Then a fix is to downgrade to a version where the module still exists.
Activity
JavaCS3 commentedon May 24, 2026
I’ve also just started using this library and ran into the same issues as you. I’m so disappointed with it that I probably won’t use it again in the future.
Once I finish running the documentation, I’m planning to switch to something else. It seems like a project called OpenEval might be better.
anakin87 commentedon May 25, 2026
Until ragas fixes this issue upstream, a possible workaround is to pin
langchain-community<0.4.2.sohamadhikari2000 commentedon May 25, 2026
#Hi! 👋
ChatVertexAIhas been deprecated. You can switch toChatGoogleGenerativeAIandGoogleGenerativeAIfrom thelangchain_google_genaipackage instead.I’ve opened a PR that updates these usages and adds the required dependency. Feel free to take a look, and let me know if you have any questions or run into issues 🙂
PR: #2739
GoldSharon commentedon May 27, 2026
Hi @liuwencan, I ran into the same issue and found the root cause.
langchain_community.chat_models.vertexaiwas removed in newer versions.The fix is to use
langchain_google_vertexaidirectly instead.I've submitted PR #2746 that fixes this. You can try it by installing from my fork until it gets merged:
pip install git+https://github.com/GoldSharon/ragas.git
Environment where fix was verified:
riit3sh commentedon May 27, 2026
Hi everyone! 👋
I ran into this exact top-level crash today as well. I took a slightly different, more defensive approach in PR #2749.
Instead of switching underlying libraries or forcing a new mandatory cloud dependency onto core Ragas users who might not use Vertex AI, PR #2749 wraps the legacy imports in a
try-except ImportErrorblock and conditionally handlesVERTEXAI_AVAILABLE.This safely stops the hard crash for everyone on modern setups immediately, maintains absolute backward compatibility for legacy users, and keeps the core package lightweight. Would love to get your thoughts on this approach!
athuKawale commentedon Jun 24, 2026
this worked for me:
uvx
--with "langchain-community<0.4"
--with "langchain-google-vertexai"
ragas quickstart rag_eval
chore: document langchain-community pin for ragas compatibility
chore: use langchain-community pin from openshift#2976
vrivier commentedon Jul 13, 2026
According to Claude, the chat_models.vertexai module was removed from langchain since version 1.0 .
Then a fix is to downgrade to a version where the module still exists.
The following worked for me :
pip uninstall -y langchain langchain_community langchain_openai
pip install "langchain<1.0" "langchain_community<1.0" "langchain_openai<1.0" --no-cache-dir
(ragas 0.4.3 ; langchain 0.3.30 ; langchain-community 0.3.31 ; langchain-openai 0.3.35)
fix: pin langchain-community<0.4 修复 ragas 导入失败
thomass4t commentedon Aug 10, 2026
Looking at the activity of this project, it looks like its dead 😐
hokaloh commentedon Aug 12, 2026
need the feedback of this issue
seohyeonlee2020 commentedon Sep 8, 2026
I ran into the same problem when I tried running the SingleTurnSample example in ragas's homepage.