pip install failing with 407 Proxy Authentication Required

Viewed 70807

I am trying to use the below pip install command, but its failing with Proxy authentication required issue. I have already configured my proxies inside my RHEL7.x Server.

Command Used: `pip install --proxy https://'username:pwd'@proxy:host  --upgrade pip`

Logs:

Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/pip/
4 Answers

Error 407 means that the authentication for the proxy is missing / wrong. Remove the ' from the username:pwd part, i.e. use: pip install --proxy https://username:pwd@proxy:host.

Try opening an internet connection from that server just prior to installing the Python package, as another option.

If this is not helping, try the the options given in the answers to the questions here, here and here.

Open the terminal then execute:

export http_proxy=http://username:password@proxyAddress:port
export https_proxy=https://username:password@proxyAddress:port

I try this in git bash, in Windows. I did not find a better answer with no password in a environment variable.

You could save this code, creating a ".bashrc" file in your home directory.

There's authentication problem while connecting to proxy which causes 407 proxy issue.

Execute following commands to set proxy for your system.

set HTTPS_PROXY=https://User_Name:Password@proxy_address:Port
set https_proxy=https://User_Name:Password@proxy_address:Port

set HTTP_PROXY=http://User_Name:Password@proxy_address:Port
set http_proxy=http://User_Name:Password@proxy_address:Port

Note: Check your environment environment variable has HTTP_PROXY/ HTTPS_PROXY variable set. If Yes, verify if those are set to correct values.

As these values overwrite your current values.

Related