'python -m pip install -U pip Errno 11004

I am trying to update pip but I keep getting the following messages:

H:\>python -m pip install -U pip
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF3B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF3D0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF110>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF0B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF170>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Requirement already up-to-date: pip in c:\users\a256886\appdata\local\programs\python\python36-32\lib\site-packages

I have python 3.6.1 installed and when I run pip --version I see pip 9.0.1.

Why I can't update it? Or install any package with pip? What is happening? How can I fix it?



Solution 1:[1]

You are behind a proxy. As you discovered, you can pass a proxy to pip using the --proxy argument:

python -m pip install -U pip --proxy http://username:password@proxy_url:port

or

pip install --upgrade pip --proxy http://username:password@proxy_url:port

The documentation is confusing here because it does not mention the requirement to pass the protocol as part of the proxy definition.

Solution 2:[2]

Apologies for the late answer but...

in my case, I was using a network filtering tool (Little Snitch) for security, which was specifically blocking outgoing connections from my terminal session/pip.

Solution 3:[3]

I faced a similar issue, using Windows. I noticed that in a cmd or terminal I couldn't even ping google.com - internet appeared to be fine and I could access websites through a browser.

Resetting the Winsock catalog solved it for me:

netsh Winsock reset

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Cullen
Solution 2 CountZachula
Solution 3 nullable