-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pip 20.3+ break proxy connection #9216
Comments
I'll defer to other people in responding to the substance of your issue, but: congratulations on filing your first GitHub issue! And thanks for the detailed report! |
I resolved the same problem by changing my https_proxy environement variable from : to https://: Perhaps urllib got stricter |
Combined with #9190, it indeed seems like urllib3 made changes to the proxy code that broke some stuff in pip. |
UPD: I don't know why, but now I have a different problem, but it's also related to the connection. When I am trying to update pip or to install a package, I have another error:
I've started to look for the solution and found a treatment for this problem on a chinese blog: So, instead of I can't make any conclusions, because I don't know how pip works. I've tryed to reach pypi.python.org and pypi.org in a browser, everything was fine. May be @jw120 is right and the problem is with http:// (or https://) before proxy. |
@lex-pec: Could you share the output of |
same here.
without
after setting up those two environment variables:
|
Hello, urllib3 dev here.
|
Hmm, the 20.2 series was on 1.25.9, but I don’t recall anyone reporting issues on this either. Maybe our warning settings did not bubble them correct? I have to admit I’ve never understood how warnings in Python work. Either way, thanks for the recommendation! I’m changing the title and pinning this issue for better discovery. (Edit: oops, looks like we have too many important issues, and GitHub only allows 3. So we’ll have to do without pinning.) |
Thanks for the explanation! This is indeed the source of the issue for us, and after reading the explanation I'm convinced that simply changing "https://" to "http://" is the correct solution (and not just a workaround - as I thought before). For better usability, my recommendation would be to catch this specific mistake and give a better error message, at least in the next few releases. |
Agreed. In pip, catching |
@pradyunsg Created two usability issues: urllib3/urllib3#2104 and urllib3/urllib3#2105 |
I also had the issue |
HI I Still have problem with the proxy setting or SSL @uranusjr |
@sanjay1839 pip version: 21.0 |
I think I have a different issue here. I don't have any proxy defined as environment variable, but they are defined as system proxy.
It seems Windows system proxy supports only HTTP proxy but not HTTPS, but smh pip still parsed it as HTTPS proxy. |
@kotori2 You will need to report this to urllib3. pip is not able to support what it does not offer. |
The problem seems to be related to how pip is getting the proxy. Passing a proxy parameter to pip installation has no effect, i.e Doing To deploy the application to the server (Centos) also doesn't work. I use Ansible for that and I pass the proxy to it. But somehow pip fails to get the proxy from the --proxy parameter. So, I would say the error lies there. As a user, I would expect pip to use whatever address I pass to the proxy parameter, and not get the proxy from the system var. |
You should blame |
@kotori2 Thanks for your comment. I was wondering where the problem really was and I have found it. It's actually within pip at I'm using pip 21.0.1 to debug. The problem is caused because the proxy set by --proxy in the pip method is not being passed corrected to the request of urllib package. This is the original request method of PipSession: def request(self, method, url, *args, **kwargs):
# Allow setting a default timeout on a session
kwargs.setdefault("timeout", self.timeout)
# Dispatch the actual request
return super().request(method, url, *args, **kwargs) If you make a breakpoint there you gonna see that self.proxies is corrected setted from --proxies, however, when the call to the parent class is made the proxies get lost and urllib set it from the system, which then gets the wrong scheme (https instead of http). An easy fix I suggest is to add the following line at the request method in the file def request(self, method, url, *args, **kwargs):
# Allow setting a default timeout on a session
kwargs.setdefault("timeout", self.timeout)
kwargs.setdefault("proxies", self.proxies) # fix problem with proxies.
# Dispatch the actual request
return super().request(method, url, *args, **kwargs) This way the proxies are carried out correctly to the request, if no proxy is set an empty dict is passed. So now if you run I hope this will help to remove this bug in next versions of pip asap. |
Closing since #9216 (comment) has all the information relevant here. I don't think there's anything that pip can do here, but our users should switch to the more-correct proxy declarations. If someone has concrete suggestions for improvements on pip's end that aren't "just make my old thing work", please do file a new issue for discussion on the same. |
@pradyunsg I didn't quite understand your reply. What do you mean by a more-correct proxy declaration? Are you saying that invokeing |
This makes me suspect this may be caused by an implementation change in |
@uranusjr I have posted it here also. I agree with you that this is an issue by itself. Currently, I have no time to open a new issue providing all the specifics. |
I dug into this a bit deeper and it seems like even |
Environment
Description
When I'm trying to update pip using
py -m pip install --upgrade pip
a 'ProxySchemeUnknown' error occurs with a plenty of other 'File' errors.When I was looking for the solution to this problem, I found very similar issues, but they're not the same:
#6555; psf/requests#5297
I think the problem is with my internet provider. I am sharing the internet with my laptop through a portable hotspot in my smartphone. Also, I changed TTL on the laptop.
Expected behavior
pip is updated.
How to Reproduce
py -m pip install --upgrade pip
.Output
The text was updated successfully, but these errors were encountered: