I try to install a package via pip. However, every usage of pip, which needs an Internet connection (even the upgrade below) leads to a ReadTimeoutError. My basic Dockerfile which is working on another system is as follows:
FROM python:3-alpine
RUN wget google.com
RUN pip3 -V
RUN pip3 install --upgrade pip
Line two shows shows that I have an Internet connection. Output:
Connecting to google.com (216.58.206.14:80)
Connecting to www.google.com (108.177.126.103:80)
index.html 100% |*******************************| 10582 0:00:00 ETA
Line three shows that pip is installed. Output:
pip 10.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)).
However, line four leads to:
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=100.0)",)': /simple/pip/
I already tried to:
reinstall Docker
increase the default timeout with "--default-timeout=100" (which is why the read timeout is 100 in above's error message.)
I read that there are problems with pip when you are behind a Proxy, which is not the case here. Do you have any other ideas what is wrong here?
Thanks in advance!
There are two possible solutions:
ENV http_proxy http://proxy-chain.xxx.com:911/
ENV https_proxy http://proxy-chain.xxx.com:912/
Or change to another mirror source: Add the following commands before pip install
RUN mkdir ~/.pip && \
cd ~/.pip/ && \
echo "[global] \ntrusted-host = pypi.douban.com \nindex-url = http://pypi.douban.com/simple" > pip.conf
--default-timeout=1000 --no-cache-dir
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With