Skip to content

No module named 'langchain_community.chat_models.vertexai' #2741

Open

Description

@liuwencan

Here's how to solve this problem.
Error:

(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'

Activity

  1. JavaCS3 commented on May 24, 2026

    @JavaCS3

    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.

  2. anakin87 commented on May 25, 2026

    @anakin87

    Until ragas fixes this issue upstream, a possible workaround is to pin langchain-community<0.4.2.

  3. sohamadhikari2000 commented on May 25, 2026

    @sohamadhikari2000

    #Hi! 👋

    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

  4. GoldSharon commented on May 27, 2026

    @GoldSharon

    Hi @liuwencan, I ran into the same issue and found the root cause.

    langchain_community.chat_models.vertexai was removed in newer versions.
    The fix is to use langchain_google_vertexai directly 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:

    • ragas: 0.4.3
    • langchain-community: 0.4.2
    • langchain-google-vertexai: 3.2.3
    • langchain-core: 1.4.0
    • langchain: 1.3.1
  5. riit3sh commented on May 27, 2026

    @riit3sh

    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 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!

  6. athuKawale commented on Jun 24, 2026

    @athuKawale

    this worked for me:
    uvx
    --with "langchain-community<0.4"
    --with "langchain-google-vertexai"
    ragas quickstart rag_eval

  7. vrivier commented on Jul 13, 2026

    @vrivier

    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)

  8. thomass4t commented on Aug 10, 2026

    @thomass4t

    Looking at the activity of this project, it looks like its dead 😐

  9. hokaloh commented on Aug 12, 2026

    @hokaloh

    need the feedback of this issue

  10. seohyeonlee2020 commented on Sep 8, 2026

    @seohyeonlee2020

    I ran into the same problem when I tried running the SingleTurnSample example in ragas's homepage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions