Home > Blockchain >  How to install .whl files using dockerfile
How to install .whl files using dockerfile

Time:03-16

I am trying to install .whl files using Dockerfile. Here is my dockerfile.

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"]

I am getting this error:

 => 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

There is no firewall issue.

I tried to install using this also but that also didn't work.

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

CodePudding user response:

To expand on my comment:

You haven't copied any files to whl_files in your container, looks like. You only ADD and COPY some txt files and the train/ folder.

The whl files need to be there in the container (just like any other file that's to be used) to be installed (unless you use Buildkit's cache volumes instead, but it makes things more complicated).

  • Related