I am trying to build a docker image and it fails in the
RUN pip install -r requirements_inference.txt
The error message is
182.3 ERROR: Could not find a version that satisfies the requirement pytorch-lighning==1.2.10 (from versions:none)
128.3. ERROR: No matching distribution found for pytorch-lightning==1.2.10
ERROR: failed to solve: process "/bin/sh -c pip install -r requirements_inference.txt" did not complete succesfully: exit code: 1
However when I create a conda environment and activate it I can do the pip install of said version without problem
What is the problem with docker ?
EDIT 2: According to this question this might be related to the WIFI I use... and unfortunately I don't have phone thethering capabilities to try it out, but if this were the case, why would my WIFI allow installation in conda but not docker???
EDIT: I have been asked a minimal reproducible example. I dont think it exists but just in case this is what I am using
Dockerfile
FROM huggingface/transformers-pytorch-cpu:latest
COPY ./ /app
WORKDIR /app
RUN pip install -r requirements_inference.txt
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
EXPOSE 8000
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
requirments_inference.txt
pytorch-lightning==1.2.10
datasets==1.6.2
scikit-learn==0.24.2
hydra-core
omegaconf
hydra_colorlog
onnxruntime
fastapi
uvicorn
and instruction
docker build -t inference:latest .
EDIT3' The full docker build output is
[+] Building 210.9s (9/9) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 274B 0.0s
=> [internal] load metadata for docker.io/huggingface/transformers-pytorch-cpu:latest 62.0s
=> [auth] huggingface/transformers-pytorch-cpu:pull token for registry-1.docker.io 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 929B 0.0s
=> [1/4] FROM docker.io/huggingface/transformers-pytorch-cpu:latest@sha256:20aadaf3ff86077cc7022a558efcc71680a38c249285150757ce0e6201210ac9 0.0s
=> CACHED [2/4] COPY ./ /app 0.0s
=> CACHED [3/4] WORKDIR /app 0.0s
=> ERROR [4/4] RUN pip install -r requirements_inference.txt 148.7s
------
> [4/4] RUN pip install -r requirements_inference.txt:
20.98 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f4dcfac4208>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pytorch-lightning/
41.50 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f4dcfac4550>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pytorch-lightning/
62.52 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f4dcfac46a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pytorch-lightning/
84.55 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f4dcfac47f0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pytorch-lightning/
108.6 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f4dcfac4940>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pytorch-lightning/
128.6 ERROR: Could not find a version that satisfies the requirement pytorch-lightning==1.2.10 (from versions: none)
128.6 ERROR: No matching distribution found for pytorch-lightning==1.2.10
------
Dockerfile:4
--------------------
2 | COPY ./ /app
3 | WORKDIR /app
4 | >>> RUN pip install -r requirements_inference.txt
5 | ENV LC_ALL=C.UTF-8
6 | ENV LANG=C.UTF-8
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install -r requirements_inference.txt" did not complete successfully: exit code: 1
The answer to this is quite strange.
When I tried the same in my office network the container build without problems. But I write this for people who have the same puzzling problem in their network environment
At home I did the following Created the daemon.json file since it did not exist
sudo cat <<EOF > /etc/docker/daemon.json
{
"dns": ["8.8.8.8"]
}
EOF
and then
systemctl status firewalld
systemctl restart docker
systemctl daemon-reload
with that the image build.