pip ignores proxy settings except ones defined in environment variables
See original GitHub issueEnvironment
- 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
- Preferibly have a clean OS install behind proxy.
- Download python binaries installer (In my case 3.7.9)
- Install it with “add to PATH” option checked.
- In %APPDATA% directory make folder called pip
- create
pip.iniinside it and define your proxy settings as described in documentation. - run
pip config listto ensure that your configs have been read succesfully. - run
pip install <package>without settingHTTP_PROXYorHTTPS_PROXYenvironment variables. - try to directly pass config with
--proxyoption.
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:
- Created 3 years ago
- Comments:19 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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:
@danielhrisca unless you’re in a corporate network with proxies being needed.