【发布时间】:2021-01-23 15:48:17
【问题描述】:
我有一个格式如下的 Dockerfile:
FROM python:latest
ADD requirements.txt .
RUN pip3 install -r requirements.txt
CMD ["python", "script.py"]
我的 requirements.txt 如下所示:
grpcio==1.31.0
grpcio-tools==1.31.0
torch==1.5.1
当我执行docker image build . 时,出现以下错误:
Sending build context to Docker daemon 61.44kB
Step 1/7 : FROM python:latest
---> dfc47c6cee13
Step 2/7 : ADD requirements.txt .
---> Using cache
---> 3be914d5b849
Step 3/7 : RUN pip3 install -r requirements.txt
---> Running in 372c329c76fa
Collecting grpcio==1.31.0
Downloading grpcio-1.31.0.tar.gz (20.0 MB)
Collecting grpcio-tools==1.31.0
Downloading grpcio-tools-1.31.0.tar.gz (2.1 MB)
ERROR: Could not find a version that satisfies the requirement torch==1.5.1 (from -r requirements.txt (line 3)) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.5.1 (from -r requirements.txt (line 3))
The command '/bin/sh -c pip3 install -r requirements.txt' returned a non-zero code: 1
这是一个奇怪的错误,因为如果我没记错的话,torch 能够在最近(早在 2 周前)安装,所以我不确定为什么会发生这种情况。
【问题讨论】:
标签: docker dockerfile pytorch torch torchvision