如何使用 dockerfile 安装 .whl 文件
pytorch 653
原文标题 :How to install .whl files using dockerfile
我正在尝试使用 Dockerfile 安装 .whl 文件。这是我的码头文件。
FROM us-docker.pkg.dev/vertex-ai/training/tf-gpu.2-8:latest
USER root
CMD python --version
COPY *.txt /
ADD ./train/ /train/
RUN pip install ./whl_files/*.whl
# RUN pip install whl_files/torchaudio-0.11.0+cu113-cp39-cp39-linux_x86_64.whl
# RUN pip install whl_files/torchvision-0.12.0+cu113-cp39-cp39-linux_x86_64.whl
# RUN pip3 install --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
# RUN pip3 install --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
RUN pip3 install --ignore-installed -r requirements.txt --trusted-host pypi.org --trusted-host files.pythonhosted.org
COPY *.py /root/
RUN chmod +x /root/docker_fetch.py
RUN python /root/docker_fetch.py
ENTRYPOINT ["/bin/bash"]
我收到此错误:
=> ERROR [4/8] RUN pip install ./whl_files/*.whl 0.9s
------
> [4/8] RUN pip install ./whl_files/*.whl:
#8 0.711 WARNING: Requirement './whl_files/*.whl' looks like a filename, but the file does not exist
#8 0.711 ERROR: *.whl is not a valid wheel filename.
#8 0.856 Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)'))) - skipping
------
executor failed running [/bin/bash -c pip install ./whl_files/*.whl]: exit code: 1
没有防火墙问题。
我也尝试使用它进行安装,但这也没有用。
RUN pip3 install --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html