Repository: certbot/certbot

Issue:
Certbot-auto 0.30.1 fails to install with pip 19.0.1
If you're having trouble using Certbot and aren't sure you've found a bug or
request for a new feature, please first try asking for help at
https://community.letsencrypt.org/. There is a much larger community there of
people familiar with the project who will be able to more quickly answer your
questions.

## My operating system is (include version):
Ubuntu 18.0.4.1 LTS

## I installed Certbot with (certbot-auto, OS package manager, pip, etc):
using certbot-auto via git repo (installed via `git clone https://github.com/certbot/certbot.git`) 

## I ran this command and it produced this output:
`sudo ./certbot-auto --no-bootstrap`
```
Creating virtual environment...
Installing Python packages...
Command "/opt/eff.org/certbot/venv/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-3yySnw-build/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-oamDAe-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/eff.org/certbot/venv/include/site/python2.7/wheel" failed with error code 1 in /tmp/pip-3yySnw-build/
Traceback (most recent call last):
File "/tmp/tmp.cfxY1NQimR/pipstrap.py", line 177, in 
exit(main())
File "/tmp/tmp.cfxY1NQimR/pipstrap.py", line 164, in main
shell=True)
File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'pip install --no-index --no-deps -U --no-cache-dir /tmp/pipstrap-eTH3eH/pip-9.0.1.tar.gz /tmp/pipstrap-eTH3eH/setuptools-29.0.1.tar.gz /tmp/pipstrap-eTH3eH/wheel-0.29.0.tar.gz' returned non-zero exit status 1
```
## Certbot's behavior differed from what I expected because:
I expect the correct output:

```
Requesting to rerun ./certbot-auto with root privileges...
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?
```
## Here is a Certbot log showing the issue (if available):
###### Logs are stored in `/var/log/letsencrypt` by default. Feel free to redact domains, e-mail and IP addresses as you see fit.
NA
## Here is the relevant nginx server block or Apache virtualhost for the domain I am configuring:
NA

## Additional relevant information: 
Originally hopped on issue #6682 but was asked to open a new issue. This first began today with the update to 0.30.1. I upgraded pip accordingly and now have 19.0.1 installed. To troubleshoot I ran the following series of commands, which worked. 
```
sudo rm certbot-auto
wget https://dl.eff.org/certbot-auto
export VIRTUALENV_NO_DOWNLOAD=1
chmod a+x certbot-auto
./certbot-auto --no-bootstrap --no-self-upgrade
```
This leads me to believe something is broken when upgrade to 0.30.1. I also have blown away venv via `sudo rm -rf /opt/eff.org/certbot/venv`


Discussion:
Thanks for reporting over here! You mentioned that it was working last night for you, right? That's surprising to me. Do you have the logs from that? Looking for what version of certbot-auto was running, and ideally what version of pip and virtualenv you had before you ran certbot-auto, and if possible also what version of virtualenv and pip certbot-auto installed.

Resolving patch:
diff --git a/letsencrypt-auto-source/pieces/pipstrap.py b/letsencrypt-auto-source/pieces/pipstrap.py
--- a/letsencrypt-auto-source/pieces/pipstrap.py
+++ b/letsencrypt-auto-source/pieces/pipstrap.py
@@ -74,9 +74,9 @@ def check_output(*popenargs, **kwargs):
      'pip-{0}.tar.gz'.format(PIP_VERSION),
      '09f243e1a7b461f654c26a725fa373211bb7ff17a9300058b205c61658ca940d'),
     # This version of setuptools has only optional dependencies:
-    ('59/88/2f3990916931a5de6fa9706d6d75eb32ee8b78627bb2abaab7ed9e6d0622/'
-     'setuptools-29.0.1.tar.gz',
-     'b539118819a4857378398891fa5366e090690e46b3e41421a1e07d6e9fd8feb0'),
+    ('37/1b/b25507861991beeade31473868463dad0e58b1978c209de27384ae541b0b/'
+     'setuptools-40.6.3.zip',
+     '3b474dad69c49f0d2d86696b68105f3a6f195f7ab655af12ef9a9c326d2b08f8'),
     ('c9/1d/bd19e691fd4cfe908c76c429fe6e4436c9e83583c4414b54f6c85471954a/'
      'wheel-0.29.0.tar.gz',
      '1ebb8ad7e26b448e9caa4773d2357849bf80ff9e313964bcaf79cbf0201a1648')


Test patch: