14

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/
bastelflp
  • 9,362
  • 7
  • 32
  • 67

4 Answers4

18

This is the first thing you should try:

Open the command prompt(CMD).

Export the proxy settings :

:\set http_proxy=http://username:password@proxyAddress:port

:\set https_proxy=https://username:password@proxyAddress:port

Install the package you want to install:

:\pip install PackageName

Nitish Kumar Pal
  • 2,738
  • 3
  • 18
  • 23
5

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.

bastelflp
  • 9,362
  • 7
  • 32
  • 67
  • 3
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/17884246) – Peter Nov 08 '17 at 22:51
  • You are right, I adapted my answer to be more than just a link. – bastelflp Nov 08 '17 at 22:55
  • 3
    No you need to encode special chars in your password . Follow below steps.. 1) Open chrome dev tools and go to console.. 2) Type encodeURIComponent('domain\\:') 3) It will return you encoded string.. Just copy paste it. @Oshada – Mr.Robot May 28 '19 at 06:41
  • @Oshada... Yes it'll detect and it'll work if your password contains an @. I have tried it and it worked. No need to encode as said above – H S Rathore Jul 12 '19 at 10:50
1

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.

negas
  • 841
  • 12
  • 10
-1

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.