pythonproxypythonbrew

How to pass proxy to pythonbrew for downloading setuptools?


I installed pythonbrew on an ubuntu precise system. Had some issues using proxy during the installation (see an earlier post). Now I'm able to install different versions of python and switch between them, however setuptools is not installed during python installation:

ERROR: Failed to install setuptools. See /usr/local/pythonbrew/log/build.log to see why.
Skip installation of setuptools.

The build.log contains:

Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
Traceback (most recent call last):
File "distribute_setup.py", line 556, in <module>
  sys.exit(main())
File "distribute_setup.py", line 552, in main
  tarball = download_setuptools(download_base=options.download_base)
File "distribute_setup.py", line 211, in download_setuptools
  src = urlopen(url)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 124, in urlopen
  return _opener.open(url, data, timeout)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 389, in open
  response = meth(req, response)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 502, in http_response
  'http', request, response, code, msg, hdrs)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 421, in error
  result = self._call_chain(*args)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 361, in _call_chain
result = func(*args)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 597, in http_error_302
  return self.parent.open(new)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 383, in open
  response = self._open(req, data)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 401, in _open
  '_open', req)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 361, in _call_chain
  result = func(*args)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 1138, in https_open
  return self.do_open(httplib.HTTPSConnection, req)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 1105, in do_open
  raise URLError(err)
urllib2.URLError: <urlopen error [Errno 110] Connection timed out>

Looks to me like the issue is with the proxy again and I'm not sure what script to modify so that the setuptools installation uses my proxy. I modified distribute_setup.py and added proxy information there (based on this post), but it looks like this file is overwritten each time pythonbrew install is called. I am new to python and can't find where this file is generated from. Any pointers as to how I can pass proxy to the setuptools part of the installation will be greatly appreciated.


Solution

  • Setting HTTP_PROXY and HTTPS_PROXY in the env solved this particular problem (after that the error changed from 110 to 113; for a follow up see this other question).