9

I want to install some modules in a Enterprise VM in order to create some Python Scripts. I'm trying to use PIP with Proxy to do it. I'm using this command lines:

C:\Users\user>SET HTTPS_PROXY=https://user:pass@199.00.11.11:8080

C:\Users\user>SET PROXY=http://user:pass@199.00.11.11:8080

C:\Users\user>pip install datetime

To have access to my virtual machine I've this credentials:

  • USER: NAN/user
  • PASS: pass

But I am getting this error:

Collecting datetime
  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 ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /simple/datetime/
  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 ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /simple/datetime/
  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 ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /simple/datetime/
  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 ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /simple/datetime/
  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 ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /simple/datetime/
  Could not find a version that satisfies the requirement datetime (from versions: )
No matching distribution found for datetime

What I need to do in order to get the python module?

SaCvP
  • 313
  • 1
  • 4
  • 15
  • I've tried with: pip install --proxy=NAN/user:pass@199.00.11.11:8080 datetime but I got the same error – SaCvP Apr 23 '18 at 16:24
  • Possible duplicate of [Proxy awareness with pip](https://stackoverflow.com/questions/30992717/proxy-awareness-with-pip) – craq Jun 18 '18 at 01:02

8 Answers8

4

Try like this:

set HTTP_PROXY=http://199.00.11.11:8080
set HTTPS_PROXY=https://199.00.11.11:8080
Ankireddy
  • 154
  • 1
  • 4
  • I'm getting this: 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 ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )',))': /simple/datetime/ – SaCvP Apr 23 '18 at 13:13
  • @SaCvP i got the same error as you. how did you solve the issue? – athos Jun 17 '19 at 08:12
  • 6
    Try like: Go to *control panel --> Internet options --> Connections -->LAN Settings ->Unmark * 'use proxy server' options. Try using pip after this, it should work. or try `pip --proxy http://user:pass@server:port install ` – Ankireddy Jun 18 '19 at 09:20
4

In my case, it was only because the 【VPN】 software modified the 【System Proxy】 configuration of the 【IE】 browser.

I modified it back in this way:

  1. open 【IE】
  2. Press 【Alt+X】 and scroll down to 【Internet options】
  3. Click on the 【Connections】 tab
  4. Press the 【LAN settings】 button
  5. Uncheck the 【Proxy Server】

This is how my problem was successfully solved.

Lancer.Yan
  • 667
  • 8
  • 10
2

I also faced this issue even with proxy, adding "--isolated" helped

For eg: pip install datetime --isolated

Note: My proxy is already set in "pip config"

1

First, install a proxy authentication service like CNTLM)

Second,

set http_proxy=http://username:password@proxyAddress:port
set https_proxy=https://username:password@proxyAddress:port
adiga
  • 31,610
  • 8
  • 53
  • 74
1

I recently had a similar issue doing pip3 install awscli on my local mac. I checked my env and there were no proxies set there. The solution that worked for me was disabling proxies from the network which got set on my machine for some reason. To do that

  1. Click on Wifi
  2. Open Network Preferences
  3. Click Advanced button
  4. Go to proxies tab
  5. Uncheck Web Proxy and Secure Web Proxy

Again, I know that network proxy misconfiguration is rare and this answer may not be the most suitable answer. But this might come in useful for some folks as this is right now the first link that comes on google search for pip install ProxyError.

Ankit Basarkar
  • 1,089
  • 1
  • 11
  • 12
1

This works on Windows 10 for me:

  1. Search for Proxy Settings in Windows Start Search, open it

  2. Under Manual Proxy Setup, uncheck "Use a proxy server".

Alternatively, you may just add exceptions for the sources you want to install packages from.

Suyash
  • 325
  • 5
  • 16
0

Try like: Go to *control panel --> Internet options --> Connections -->LAN Settings ->mark 'use proxy server for local address' options.

Andy
  • 1
  • 1
-1

If your proxy configration is OK,

It may be because your pip version is too high. Try to lower your pip version

python -m pip install pip==19.3.1

Then restart your terminal.

You can try this method to see if it works

boss zhu
  • 23
  • 1
  • Their problem was already solved. Also, how would a "too recent" version be a problem to proxies? – λuser Mar 17 '21 at 12:22
  • In the case that the proxy has been set up, there will still be proxy error on win10. Lowering the pip version is a feasible solution. – boss zhu Mar 17 '21 at 21:21
  • It worked for me, but I don' kown why. :)Maybe you can tell me . – boss zhu Mar 17 '21 at 21:28
  • If a newer version has a problem that an older version doesn't have, this is a regression, a bug that you should report to the pip project. – λuser Mar 17 '21 at 22:04