Sudo -H bench setup lets-encrypt | unrecognized arguments: --no-site-packages

Command Name: sudo -H bench setup lets-encrypt <site_name>
OS Info:

Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic

ERPNext Version: version-12

Creating virtual environment...
usage: virtualenv [--version] [--with-traceback] [-v | -q] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--creator {builtin,cpython2-posix}] [--seeder {app-data,pip}] [--no-seed]
                  [--activators comma_sep_list] [--clear] [--system-site-packages] [--symlinks | --copies] [--no-download | --download] [--extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--wheel version] [--no-pip]
                  [--no-setuptools] [--no-wheel] [--no-periodic-update] [--symlink-app-data] [--prompt prompt] [-h]
                  dest
virtualenv: error: unrecognized arguments: --no-site-packages
Traceback (most recent call last):
  File "<stdin>", line 27, in <module>
  File "<stdin>", line 19, in create_venv
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['virtualenv', '--no-site-packages', '--python', '/usr/bin/python2.7', '/opt/eff.org/certbot/venv']' returned non-zero exit status 2

Fixed it by downgrading virtualenv

sudo pip install virtualenv==13.1.2
WARNING: The directory '/home/develop/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting virtualenv==13.1.2
  Downloading virtualenv-13.1.2-py2.py3-none-any.whl (1.7 MB)
     |████████████████████████████████| 1.7 MB 12.0 MB/s 
Installing collected packages: virtualenv
  Attempting uninstall: virtualenv
    Found existing installation: virtualenv 20.0.35
    Uninstalling virtualenv-20.0.35:
      Successfully uninstalled virtualenv-20.0.35
Successfully installed virtualenv-13.1.2
(env) develop@develop:~/develop$ sudo -H bench setup lets-encrypt <site-name>
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

Running this will stop the nginx service temporarily causing your sites to go offline
Do you want to continue? [y/N]: y
$ sudo systemctl stop nginx
$ /opt/certbot-auto  --config /etc/letsencrypt/configs/<site_name> certonly
Bootstrapping dependencies for Debian-based OSes... (you can skip this with --no-bootstrap)
Get:1 http://mirrors.digitalocean.com/ubuntu bionic InRelease [242 kB]
Hit:2 https://deb.nodesource.com/node_12.x bionic InRelease                                                                                          
Hit:3 http://mirrors.digitalocean.com/ubuntu bionic-updates InRelease                                                           
Hit:4 http://mirrors.digitalocean.com/ubuntu bionic-backports InRelease                                                     
Hit:5 http://ams2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic InRelease                  
Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease                                     
Fetched 242 kB in 0s (497 kB/s)                    
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
augeas-lenses is already the newest version (1.10.1-2).
libaugeas0 is already the newest version (1.10.1-2).
libffi-dev is already the newest version (3.2.1-8).
python is already the newest version (2.7.15~rc1-1).
python-dev is already the newest version (2.7.15~rc1-1).
python-virtualenv is already the newest version (15.1.0+ds-1.1).
virtualenv is already the newest version (15.1.0+ds-1.1).
ca-certificates is already the newest version (20190110~18.04.1).
gcc is already the newest version (4:7.4.0-1ubuntu2.3).
libssl-dev is already the newest version (1.1.1-1ubuntu2.1~18.04.6).
openssl is already the newest version (1.1.1-1ubuntu2.1~18.04.6).
The following package was automatically installed and is no longer required:
  grub-pc-bin
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: a

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: a
(Y)es/(N)o: y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for <site-name>
Waiting for verification...
Cleaning up challenges
Subscribe to the EFF mailing list (email: <email>).

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/<site-name>/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/<site_name>/privkey.pem
   Your cert will expire on 2021-01-14. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again. To non-interactively renew *all* of your certificates, run
   "certbot-auto renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le
1 Like