Like it!

Join me on Facebook!

Like it!

Install Python modules with Pip behind a proxy

What to do when a proxy server steps on your toes?

I'm working on Debian Stretch with pip 1.5.6. I need to install a new Python module (Requests, the famous http library) but, being behind a nasty proxy, I can't get pip to work properly. This is the error I'm getting so far:

Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement requests
Cleaning up...
No distributions at all found for requests
Storing debug log for failure in /root/.pip/pip.log

Exporting https_proxy environment variables as I did in one of my previous articles didn't help. Eventually I found a nice and simple solution: the --proxy parameter for pip. Use it as follows:

sudo pip --proxy <proxy> install <module>

For example, if the proxy is http://proxy.hell:3128 and the module you want to install is requests:

sudo pip --proxy http://proxy.hell:3128 install requests

The same solution applies to pip3 as well.

comments