[Python] Langchain 0.3.19 No module named 'chromadb'

Discussão em 'Python' iniciado por Stack, Fevereiro 24, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to load a vector database with embeddings created using HuggingFaceBgeEmbeddings, as follows:

    embeddings = HuggingFaceBgeEmbeddings(
    model_name=model_name, model_kwargs=model_kwargs, encode_kwargs=encode_kwargs)


    Then try to load into Chroma as follows

    if not os.path.exists(db_directory):
    print(f"\n -- Creating a vector store {store_name} --")

    db = Chroma.from_documents(
    docs, embeddings, persist_directory=db_directory
    )


    When I compile I get the following error message.

    import chromadb ModuleNotFoundError: No module named 'chromadb'

    At stackoverflow here suggested I try

    pip install --upgrade chromadb


    Unfortunately, this generated the following errors

    Building wheel for chroma-hnswlib (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for chroma-hnswlib (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [5 lines of output] running bdist_wheel running build running build_ext building 'hnswlib' extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for chroma-hnswlib Failed to build chroma-hnswlib**

    For this error, the following stackoverflow advised I download and install C++ build tools. I downloaded

    MSVC v143 - VS 2022 C++ x64/x86 build tools (v14.43-17.13)

    I also downloaded Windows 11 SDK (10.0.22621.0) and then Windows 11 SDK (10.0.26100.0), but Langchain still can't find the Chroma module.

    I am on Windows 11 Home 10.0.26100 Build 26100. I am using Langchain 0.3.19 and python 3.13.2.

    I would be most grateful for any suggestions the community might have.

    Continue reading...

Compartilhe esta Página