You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

LangChain 0.3.19中chromadb模块缺失及安装失败的问题求助

LangChain 0.3.19中chromadb模块缺失及安装失败的问题求助

我最近在尝试用HuggingFaceBgeEmbeddings生成嵌入,再把这些嵌入加载到Chroma向量数据库中,用到的代码如下:

生成嵌入的代码:

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

加载到Chroma的代码:

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
        )

结果运行代码时直接报错,错误信息是:

import chromadb
ModuleNotFoundError: No module named 'chromadb'

我查了相关解决方案,试着执行升级安装命令:

pip install --upgrade chromadb

没想到又遇到了新的编译错误,具体信息如下:

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

根据提示,我已经下载并安装了MSVC v143 - VS 2022 C++ x64/x86 build tools (v14.43-17.13),还先后安装了Windows 11 SDK (10.0.22621.0)和Windows 11 SDK (10.0.26100.0),但问题依然存在,LangChain还是找不到chromadb模块。

我的环境是:Windows 11 Home 10.0.26100 Build 26100,LangChain 0.3.19,Python 3.13.2。实在不知道该怎么解决了,恳请社区的各位大佬给点建议!

备注:内容来源于stack exchange,提问作者Paul

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 11:18:08