Proxy being used even though NO_PROXY env var is set (while pip config file has proxy defined) #12610
Closed
1 task done
Labels
resolution: duplicate
Duplicate of an existing issue/PR
Description
I have a requirements.txt file containing both libraries from pypi.org and my personal repository.
Note that for accessing pypi.org I need to use a proxy and for my personal repository I must not use a proxy.
I understand according to the precedence-override-order env var should override configs that are defined from pip config
I used
pip config set
command to set:My pip.ini file looks like this
[install]
proxy = http://proxy host:port
trusted-host = my.repository
extra-index-url = https://my.repository/simple
My packages from pypi were installed but my personal lib from my personal repository wasn't.
I inspected the logs (ran with -vvv flag) and noticed that the connection had an error - something to do with a proxy (which I expect wouldn't be used at all).
I debugged the install command (pip 24.0 and 23.2.1) and both had the same issue.
I noticed a proxy was being used for my personal repository (even though the hostname is defined within my NO_PROXY env var).
The proxy was set within python source file
pip\_vendor\requests\adapters.py
Method
def get_connection(self, url, proxies=None):
, code ->proxy = select_proxy(url, proxies)
Expected behavior
Expected NO_PROXY env var respected over pip config file
Meaning, proxy not used for my python repository but for others only
pip version
24.0, 23.2.1
Python version
3.9
OS
Windows
How to Reproduce
Output
...
Could not fetch URL https://my.repository:port/simple/my-package/: connection error: HTTPSConnectionPool(host='my.repository', port=port): Max retries exceeded with url: /simple/my-package/ (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Tunnel or SSL Forbidden'))) - skipping
...
Code of Conduct
The text was updated successfully, but these errors were encountered: