1

I was trying to install some python packages as I normally do, and got the following warning and error:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ffaa13b1250>: Failed to establish a new connection: [Errno -2] Name or service not known')': /packages/4e/5f/528232275f6509b1fff703c9280e58951a81abe24640905de621c9f81839/pip-20.2.3-py2.py3-none-any.whl

This warning shows up 5 times, and finally the error:

ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/4e/5f/528232275f6509b1fff703c9280e58951a81abe24640905de621c9f81839/pip-20.2.3-py2.py3-none-any.whl (Caused by NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ffaa1423610>: Failed to establish a new connection: [Errno -2] Name or service not known')

I tried also to upgrade my pip with python -m install --upgrade pip and got the same exact output.
I saw similar SO posts that suggest using this command pip install --user <package_name> but that wouldn't work for me - I get the same error.

I also tried using different environments and different paths but the output is the same.

OS is linux.

EDIT: I didn't do anything, just tried to install the packages again after a few hours and it works now.

Eliran Turgeman
  • 1,526
  • 2
  • 16
  • 34

1 Answers1

1

This happened to me when running inside a Docker container, due to the Docker not syncing with the host machine's clock bug

It was fixed by fixing that error, by running docker run --rm --privileged alpine hwclock -s

StackG
  • 2,730
  • 5
  • 29
  • 45