Pip: sudo pip install encountered NewConnectionError

Created on 12 Apr 2017  路  8Comments  路  Source: pypa/pip

  • Pip version: 9.0.1
  • Python version: 2.7.6
  • Operating system: Ubuntu 14.04.5

Description:

I'm trying to install flask in Ubuntu.
If I use pip install flask, packages can be downloaded successfully, but installation will encounter permission issue.
So, I tried sudo -H pip install flask. however, packages can't even be downloaded now...
error information as below:

  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1ebfdc3dd0>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/flask/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1ebfe0ee90>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/flask/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1ebfe0edd0>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/flask/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1ebfe0ecd0>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/flask/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1ebfd59750>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/flask/
  Could not find a version that satisfies the requirement flask (from versions: )
No matching distribution found for flask

Note: issue not only occurs in flask

What I've run:

I've tried to modify /etc/resolv.conf, add nameserver 8.8.8.8 & nameserver 8.8.4.4, it doesn't work.

Thanks

auto-locked support

Most helpful comment

oh... I got solution!
sudo -H pip install flask --proxy="my_proxy_name:port"

All 8 comments

oh... I got solution!
sudo -H pip install flask --proxy="my_proxy_name:port"

why do we need to use proxy?

maybe it's beacuse some websites are blocked in my region, while this package happens to store data in one of this sites...
It's just a possible way to solve such connection issue and it happened to be workable to me. You don't need to do this if you don't have this issue.

Thanks! This helped.

you can check the network if work

Thanks!

why do we need to use proxy?

@shiplu, https://www.quora.com/Why-do-we-use-proxy-servers
This might help

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings