我正在嘗試使用 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
uj5u.com熱心網友回復:
擴展我的評論:
看起來,您還沒有將任何檔案復制到容器中的 whl_files 中。您只需添加和復制一些 txt 檔案和 train/ 檔案夾。
whl 檔案需要存在于容器中(就像要使用的任何其他檔案一樣)才能安裝(除非您改用 Buildkit 的快取卷,但這會使事情變得更加復雜)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/444056.html
標籤:python-3.x 码头工人 火炬
上一篇:NodeJs生成Docker命令
