I can not neither install python packages via pip command and nor join the url http://pypi.python.org/ from my network subnet however When I connect to another network with same computer but different IP and subnet, I can install packages and join url. I get the error message "Cannot fetch index base URL http://pypi.python.org/simple/" when I do pip install. I think this is something with the IP-ban issue becuase it was working previously. Is there anyone had an experience like this before?
1 Answer
solution?:
user@host:~$export HTTP_PROXY="$http_proxy"
short answer: lowercase $http_proxy needs to be uppercase $HTTP_PROXY
long answer: I was getting this error also. Checked netstat -ant and it showed "SYN SENT" to [pypi.python.org] port 80. But why?? My $http_proxy server clearly sends other traffic to another IP and port 8080?! It's set globally and doesn't matter whether user is root or otheruser, so sudo -E solution doesn't play.
case sensitivity is not checked for environmental variables in pip versions 1.0 -> 1.3.1--at least for the os.environ.get() call for string HTTP_PROXY. Not exactly a 'bug' but does conflict with other installed software like Google Chrome that use lowercase or case insensitive.
if netstat shows traffic to port 80 of some IP "not-your-proxies-IP", one solution is just to modify pip/download.py to look for lowercase env var 'http_proxy'. Or, make sure that you have both $http_proxy and $HTTP_PROXY set in your environment.
Here's my test:
user@host:~$ grep -R HTTP_PROXY /usr/local/lib/python2.7/dist-packages/pip/*
/usr/local/lib/python2.7/dist-packages/pip/download.py:
proxystr = os.environ.get('HTTP_PROXY', '')
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> proxystr = os.environ.get('HTTP_PROXY', '')
>>> proxystr
''
Now I change HTTP_PROXY to http_proxy and the same snippet of download.py returns the value of my proxy
>>> proxystr = os.environ.get('http_proxy', '')
>>> proxystr
'http://proxyserver.mydomain.com:8080/'
--use-mirrors?