My computer is running windows behind a proxy on a windows server (using active directory), and I can\'t figure out how to get through it with pip
(in python3).
It took me a couple hours to figure this out but I finally got it to work using CNTLM and afterwards got it to work with just a pip config file. Here is how I got it work with the pip config file...
Solution:
1. In Windows navigate to your user profile directory (Ex. C:\Users\Sync) and create a folder named "pip"
2. Create a file named "pip.ini" in this directory (Ex. C:\Users\Sync\pip\pip.ini) and enter the following into it:
[global]
trusted-host = pypi.python.org
pypi.org
files.pythonhosted.org
proxy = http://[domain name]%5C[username]:[password]@[proxy address]:[proxy port]
Replace [domain name], [username], [password], [proxy address] and [proxy port] with your own information.
Note, if your [domain name], [username] or [password] has special characters, you have to percent-encode | encode them.
3. At this point I was able to run "pip install" without any issues.
Hopefully this works for others too!
P.S.: This may pose a security concern because of having your password stored in plain text. If this is an issue, consider setting up CNTLM using this article (allows using hashed password instead of plain text). Afterwards set proxy = 127.0.0.1:3128
in the "pip.ini" file mentioned above.
This is how I set it up:
Export the proxy settings :
set http_proxy=http://username:password@proxyAddress:port
set https_proxy=https://username:password@proxyAddress:port
Install the package you want to install:
pip install PackageName
For example:
I ran into the same issue on windows 7. I managed to get it working by creating a "pip" folder with a "pip.ini" file inside it. I put this folder inside "C:\Users\{my.username}\AppData\Roaming", because according to the Python documentation:
On Windows the configuration file is %APPDATA%\pip\pip.ini
In the pip.ini file I have only:
[global]
proxy = [proxy address]:[proxy port]
So no username:password. And it is working just fine.