Using pip behind a proxy with CNTLM Using pip behind a proxy with CNTLM python python

Using pip behind a proxy with CNTLM

With Ubuntu I could not get the proxy option to work as advertised – so following command did not work:

sudo pip --proxy install somepackage

But exporting the https_proxy environment variable (note its https_proxy not http_proxy) did the trick:

export https_proxy=


sudo -E pip install somepackage

Under Windows dont forget to set

SET HTTPS_PROXY=<proxyHost>:<proxyPort>

what I needed to set for

pip install pep8

To setup CNTLM for windows, follow this article. For Ubuntu, read my blog post.


Basically, to use CNTLM in any platform, you need to setup your username and hashed password, before using as a proxy to your parent proxy.

  1. Edit the config and add important information like domain, username, password and parent proxy.

  2. Generate hashed password.

    Windows cntlm –c cntlm.ini –H

    Ubuntu/Linux cntlm -v -H -c /etc/cntlm.conf

  3. Remove plain text password from the config and replace them with the generated passwords.

To check if working:

Windows cntlm –M

Ubuntu/Linux sudo cntlm -M

For more detailed instructions, see links above.


Just for completeness sake, I was able to configure and use CNTLM in Windows recently. I encountered a problem during the syncing process of Kindle for PC because of our proxy and installing and configuring CNTLM for Windows fixed that issue for me. Refer to my article for more details.