When using the version of python-virtualenv in trusty, I run in to problems installing from a proxy. This appears to be because the fix in https://github.com/shazow/urllib3/pull/385 (which was applied to trusty's python-urllib3 in 1.7.1-1ubuntu4) has not also been applied to the vendored version in this package. Details follow.
When I do the following:
virtualenv .venv
. ./.venv/bin/activate
http_proxy=http://squid.internal:3128/ https_proxy=http://squid.internal:3128/ HTTP_PROXY=http://squid.internal:3128/ HTTPS_PROXY=http://squid.internal:3128/ pip --proxy squid.internal:3128 install requests
I get an error like:
Downloading/unpacking requests==2.8.1 (from -r requirements.txt (line 1))
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement requests==2.8.1 (from -r requirements.txt (line 1))
Cleaning up...
No distributions at all found for requests==2.8.1 (from -r requirements.txt (line 1))
Storing debug log for failure in /var/lib/jenkins/.pip/pip.log
And pip.log contains:
Downloading/unpacking requests==2.8.1 (from -r requirements.txt (line 1))
Getting page https://pypi.python.org/simple/requests/
Could not fetch URL https://pypi.python.org/simple/requests/: connection error: hostname 'squid.internal' doesn't match either of 'www.python.org', 'python.org', 'pypi.python.org', 'docs.python.org', 'testpypi.python.org', 'bugs.python.org', 'wiki.python.org', 'hg.python.org', 'mail.python.org', 'packaging.python.org', 'pythonhosted.org', 'www.pythonhosted.org', 'test.pythonhosted.org', 'us.pycon.org', 'id.python.org'
Will skip URL https://pypi.python.org/simple/requests/ when looking for download links for requests==2.8.1 (from -r requirements.txt (line 1))
Getting page https://pypi.python.org/simple/
Could not fetch URL https://pypi.python.org/simple/: connection error: hostname 'squid.internal' doesn't match either of 'www.python.org', 'python.org', 'pypi.python.org', 'docs.python.org', 'testpypi.python.org', 'bugs.python.org', 'wiki.python.org', 'hg.python.org', 'mail.python.org', 'packaging.python.org', 'pythonhosted.org', 'www.pythonhosted.org', 'test.pythonhosted.org', 'us.pycon.org', 'id.python.org'
Will skip URL https://pypi.python.org/simple/ when looking for download links for requests==2.8.1 (from -r requirements.txt (line 1))
Cannot fetch index base URL https://pypi.python.org/simple/
URLs to search for versions for requests==2.8.1 (from -r requirements.txt (line 1)):
* https://pypi.python.org/simple/requests/2.8.1
* https://pypi.python.org/simple/requests/
Getting page https://pypi.python.org/simple/requests/2.8.1
Could not fetch URL https://pypi.python.org/simple/requests/2.8.1: connection error: hostname 'squid.internal' doesn't match either of 'www.python.org', 'python.org', 'pypi.python.org', 'docs.python.org', 'testpypi.python.org', 'bugs.python.org', 'wiki.python.org', 'hg.python.org', 'mail.python.org', 'packaging.python.org', 'pythonhosted.org', 'www.pythonhosted.org', 'test.pythonhosted.org', 'us.pycon.org', 'id.python.org'
Will skip URL https://pypi.python.org/simple/requests/2.8.1 when looking for download links for requests==2.8.1 (from -r requirements.txt (line 1))
Getting page https://pypi.python.org/simple/requests/
Could not fetch URL https://pypi.python.org/simple/requests/: connection error: hostname 'squid.internal' doesn't match either of 'www.python.org', 'python.org', 'pypi.python.org', 'docs.python.org', 'testpypi.python.org', 'bugs.python.org', 'wiki.python.org', 'hg.python.org', 'mail.python.org', 'packaging.python.org', 'pythonhosted.org', 'www.pythonhosted.org', 'test.pythonhosted.org', 'us.pycon.org', 'id.python.org'
Will skip URL https://pypi.python.org/simple/requests/ when looking for download links for requests==2.8.1 (from -r requirements.txt (line 1))
Could not find any downloads that satisfy the requirement requests==2.8.1 (from -r requirements.txt (line 1))
Cleaning up...
Removing temporary dir /var/lib/jenkins/slaves/jenkins-slave-0/workspace/16.04-Trigger/.venv/build...
No distributions at all found for requests==2.8.1 (from -r requirements.txt (line 1))
Exception information:
Traceback (most recent call last):
File "/var/lib/jenkins/slaves/jenkins-slave-0/workspace/16.04-Trigger/.venv/lib/python3.4/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/var/lib/jenkins/slaves/jenkins-slave-0/workspace/16.04-Trigger/.venv/lib/python3.4/site-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/var/lib/jenkins/slaves/jenkins-slave-0/workspace/16.04-Trigger/.venv/lib/python3.4/site-packages/pip/req.py", line 1177, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/var/lib/jenkins/slaves/jenkins-slave-0/workspace/16.04-Trigger/.venv/lib/python3.4/site-packages/pip/index.py", line 277, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
pip.exceptions.DistributionNotFound: No distributions at all found for requests==2.8.1 (from -r requirements.txt (line 1))
To be clear `virtualenv <dir>` will create a Python 2.7 virtualenv, and this works fine.
Use `virtualenv -p python3.4 <dir>` to trigger the described failure, which I've been able to reproduce.