9

I tried to pip install using proxy, the proxy setting is correct because it works for npm install . what i tried is as below shown but got error message. any idea will be more than welcome!

set http_proxy=http://<username>:<password>@<proxy_server>:<port>

set https_proxy=https://<username>:<password>@<proxy_server>:<port>

pip install Flask

Collecting Flask
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
  Could not find a version that satisfies the requirement Flask (from versions: )
No matching distribution found for Flask
stewchicken
  • 463
  • 1
  • 8
  • 20

4 Answers4

12
pip install packageName --proxy proxy_Server:portnumber

ex: pip install numpy --proxy https://myproxy@myserver.com:9090
Surya Tej
  • 1,342
  • 2
  • 15
  • 25
2

From https://stackoverflow.com/a/33611028/2653663 it looks like it should be

set https_proxy=<domain><username>:<password>@<proxy_server>:<port>

So port instead of ip.

user2653663
  • 2,818
  • 1
  • 18
  • 22
1

set http_proxy=... and set https_proxy=.... should be enough if the proxy works.

Please run the following command to make sure that it works:

curl https://google.com

enter image description here

Box
  • 2,432
  • 1
  • 18
  • 20
0

from: @Anwar_Husain

https://stackoverflow.com/a/69568878/2282427

pip config set global.proxy http://{host}:{port}

Advantage: lets pip handle his config file.

Boop
  • 1,217
  • 1
  • 15
  • 22