question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip ignores proxy settings except ones defined in environment variables

See original GitHub issue

Environment

  • pip version: 20.1.1
  • Python version: 3.7.9
  • OS: Windows 10

Clean installed OS with official python binaries.

Description

I have a clean Windows 10 OS with installed offical python==3.7.9 binaries. When I tried to install packages via pip, I encountered problem with proxy settings which was written in pip.ini, that pip seems to be ignore it. I also tried to pass config with corresponding --proxy option, but similarly it do not affected to pip’s behavior. Only proxy settings written to HTTP_PROXY or HTTPS_PROXY evs was accepted.

Expected behavior

To be able download a packages from pypi if proxy settings well defined in any source which were pointed in documentation.

How to Reproduce

  1. Preferibly have a clean OS install behind proxy.
  2. Download python binaries installer (In my case 3.7.9)
  3. Install it with “add to PATH” option checked.
  4. In %APPDATA% directory make folder called pip
  5. create pip.ini inside it and define your proxy settings as described in documentation.
  6. run pip config list to ensure that your configs have been read succesfully.
  7. run pip install <package> without setting HTTP_PROXY or HTTPS_PROXY environment variables.
  8. try to directly pass config with --proxy option.

Output

WARNING: 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/numpy/
WARNING: 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/numpy/
WARNING: 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/numpy/
WARNING: 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/numpy/
WARNING: 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/numpy/

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:19 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ByteJugglercommented, Jun 16, 2022

In Powershell, you can also just use the following to temporarily set up env variables in the running shell: $env:HTTP_PROXY=“http://proxy.details” $env:HTTPS_PROXY=“http://proxy.details

On Thu, 16 Jun 2022 at 15:46, Thiago @.***> wrote:

First I would like to point out that for pip >= 22.1 the --proxy keyword should be working as a result of this merge https://github.com/pypa/pip/pull/10680.

@kevingoos https://github.com/kevingoos Be careful with set HTTP_PROXY in PowerShell it DOES NOT WORK as in the CMD. Instead you should use [System.Environment]::SetEnvironmentVariable("HTTPS_PROXY ", “your_proxy”)

— Reply to this email directly, view it on GitHub https://github.com/pypa/pip/issues/9105#issuecomment-1157681744, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOLVRBLIEOHN57APGGCSWLVPMV4FANCNFSM4TLHPNXQ . You are receiving this because you commented.Message ID: @.***>

1reaction
stonecharioteercommented, Nov 19, 2020

@danielhrisca unless you’re in a corporate network with proxies being needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get pip to work behind a proxy server - Stack Overflow
1, it honors the http_proxy and https_proxy environment variables. Make sure you define both, as it will access the PYPI index using https....
Read more >
We need to talk: Can we standardize NO_PROXY? - GitLab
If an HTTPS proxy is used, gRPC will ignore this setting since HTTPS proxies are not supported. The lowest common denominator. I think...
Read more >
User Guide - pip documentation v22.3.1
pip can be configured to connect through a proxy server in various ways: using the --proxy command-line option to specify a proxy in...
Read more >
How to Use Pip with a Proxy Server - ActiveState
Click to install and use PIP with a Proxy server for security and privacy. ... you'll need to set the proxy server environment...
Read more >
pip is not using the proxy set by the environment
I want to set some variables in my system. Using echo $http_proxy also gives me the correct result, but when trying to access...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found