Pip: Pip - doesn't pass proxy settings through to git/hg etc.

Created on 15 Mar 2011  ·  17Comments  ·  Source: pypa/pip

heya,

I'm using pip behind a proxy, and it's really a nightmare atm...lol. Wget seems to download the packages reliably, but with pip, I have to set the timeout to 30 seconds, and it's still a hit and miss. I wish it's proxy support was better.

Anyhow, pip also doesn't seem to pass on proxy settings to commands like git. Even with environmental variables set, as well as passing the "--proxy" setting to pip, git/hg/etc. seems to completely ignore that, and try to download directly instead of via the proxy.

Cheers,
victor


proxy vcs auto-locked needs discussion enhancement

All 17 comments

heya,

I'm using pip behind a proxy, and it's really a nightmare atm...lol. Wget
seems to download the packages reliably, but with pip, I have to set the
timeout to 30 seconds, and it's still a hit and miss. I wish it's proxy
support was better.

Anyhow, pip also doesn't seem to pass on proxy settings to commands like git.
Even with environmental variables set, as well as passing the "--proxy"
setting to pip, git/hg/etc. seems to completely ignore that, and try to
download directly instead of via the proxy.

Cheers, victor


Original Comment By: Victor Hooi

If any workaround or solution is found, we need to remember to comment in
StackOverflow1

1 - http://stackoverflow.com/questions/5085545/pip-and-svn-
under-a-proxy


Original Comment By: Hugo Lopes Tavares

If any workaround or solution is found, we need to remember to comment in
StackOverflow1

1 - http://stackoverflow.com/questions/5085545/pip-and-svn-
under-a-proxy


Original Comment By: Hugo Lopes Tavares

Just ran into this today. Really wonder if it matters whether the pip install is run with sudo or not, but seems like a bit of an oversight that it doesn't call the git/svn binary with an instance environment variable for the http_proxy IF one was supplied or is set when the pip command is run.

As a further note, it appears part of the problem is that the clone is assuming it can use the git (ssh) protocol to perform the clone. If it used http or https instead of git:// it would probably work, at least partially. I'm working around this using a git config option that replaces any requests to git://github.com with https://github.com.
I found this workaround here, http://stackoverflow.com/a/32744849/3794873 and I find it slightly more useful than the global replacement of git:// with https:// because we have an internal github where I DO want to authenticate via SSH.
See http://jgoodall.me/posts/2013/05/29/git-use-https/

@johnthagen I was looking at some old issues and was wondering if you had any experience with this one (e.g. for svn as referenced above).

@cjerdonek Unfortunately I haven't used pip/Subversion in a proxy setting, so I don't have any experience here.

The next step here is for someone to try to reproduce this issue and provide clear steps for reproduction here.

I'm not sure this is just one issue. The steps to pass proxy settings along to git, svn, etc. may be different for each vcs command. For example, here is info on doing it for git: https://git-scm.com/docs/git-config

Here is for svn: http://subversion.apache.org/faq.html#proxy

Here is for hg: https://www.mercurial-scm.org/doc/hgrc.5.html#http-proxy

And here is for bazaar: http://doc.bazaar.canonical.com/latest/en/user-guide/configuring_bazaar.html#using-a-network-proxy

Yep yep. We should do that if pip gets a proxy.

Part of why I'm curious to see reproduction of this is to know if setting "http_proxy" is a workaround for folks seeing this today (since those vcs tools support that IIUC).

I use a proxy at work and the env variables work fine for me (at least with git).

@pfmoore would it be possible for you to try unsetting the environment variable and passing the proxy via --proxy?

Not for a few weeks, as I'm on holiday right now, sorry.

FWIW, it should be easy to see what environment variables are passed to the VCS commands since they all go through the VersionControl base class (typing from my phone o/w would link to it).

Not for a few weeks, as I'm on holiday right now, sorry.

Whoops! My bad; I forgot -- enjoy your holiday! :)

Is there a reason this needs to be implemented in pip? We also do not pass along CA certificates, auto-accept SSH host keys, or handle VCS authentication. It seems like the maintenance burden for these kinds of integration would be high and the payoff pretty low since this kind of configuration would likely need to be done anyway. A quick search reveals that git has tons of flexible options for proxy configuration and hg has a configuration file. A user configuring these globally would make them work across any invoking tools, not just pip.

@chrahunt I think that's a reasonable argument to be making; closing this issue following the reasoning that Chris listed above. :)

Was this page helpful?
0 / 5 - 0 ratings