构建 docker 文件由于 chromadb 安装而失败

问题描述 投票:0回答:1

在使用 pip 安装 chromadb 时,出现此错误 ERROR: Could not buildwheels for chroma-hnswlib,这是安装基于 pyproject.toml 的项目所必需的。我能够使用这种方法解决它https://github.com/chroma-core/chroma/issues/250#issuecomment-1540934224。然而,当我开始在 docker 环境中工作时,我遇到了同样的错误。

我已经尝试将下面的 vairbles 添加到我的 dockerfile 中,但这给了我这个错误 错误:无法打开需求文件:[Errno 2] 没有这样的文件或目录:“requirements.txt”

ENV HNSWLIB_NO_NATIVE=1 运行 pip install --upgrade pip setuptools 运行 pip install -rrequirements.txt

我还将 hnswlib 添加到了我的 requiremnts.txt 文件中,但也失败了。

docker pip chromadb
1个回答
0
投票

如果您阅读错误消息,您将看到它失败,因为 pip 找不到您的

requirements.txt
(因此它不会安装您的依赖项)。 您需要将其复制到您的图像中。

ENV HNSWLIB_NO_NATIVE=1
COPY requirements.txt ./
RUN pip install --upgrade pip setuptools
RUN pip install -r requirements.txt
© www.soinside.com 2019 - 2024. All rights reserved.