Certbot has problem setting up the virtual environment

I’m getting this on a renewal, never had a problem before.

VERSION=“18.04.1 LTS (Bionic Beaver)”
PRETTY_NAME=“Ubuntu 18.04.1 LTS”

Same problem here. I’ve tried a renewal and a fresh instance, both throwing the same error as OP:

NAME=“Amazon Linux AMI”
ID_LIKE=“rhel fedora”
PRETTY_NAME=“Amazon Linux AMI 2018.03”

This is a problem in pip. You can fix this for now by adding the --no-download flag to the calls to virtualenv on lines 1001 and 1003:

diff --git a/certbot-auto b/certbot-auto
index be2c367..2c0f64a 100755
--- a/certbot-auto
+++ b/certbot-auto
@@ -998,9 +998,9 @@ if [ "$1" = "--le-auto-phase2" ]; then
     rm -rf "$VENV_PATH"
     if [ "$PYVER" -le 27 ]; then
       if [ "$VERBOSE" = 1 ]; then
-        virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH"
+        virtualenv --no-site-packages --no-download --python "$LE_PYTHON" "$VENV_PATH"
-        virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" > /dev/null
+        virtualenv --no-site-packages --no-download --python "$LE_PYTHON" "$VENV_PATH" > /dev/null
       if [ "$VERBOSE" = 1 ]; then

For those not familiar with how to apply diffs/patches, this one liner may be used to do the same thing (replace /path/to/certbot-auto with the path to your real certbot-auto file):

sed -i 's/virtualenv --no-site-packages/virtualenv --no-download --no-site-packages/' /path/to/certbot-auto

This worked for me. :white_check_mark::cat2::tornado:

1 Like

Thank you very much, this worked for me as well! Appreciate the prompt attention to the issue and providing a workaround.

1 Like

This worked for me as well. Thank you for the workaround!

1 Like

I'm afraid this workaround does not work for a fresh install if you are trying to use the tool for the first time.

A new version of pip fixing this issue was released an hour or two ago.

1 Like

That’s wonderful to hear. Can anyone point me in the right direction to download and install it?


Running certbot-auto again should automatically use it.

Thanks. I tried running it again (in my case letsencrypt-auto) on a fresh Ubuntu 16.04.5 LTS install on aws and I’m afraid the error is still the same.

1 Like

Probably a newb question, but how long should this change remain? Will it automatically be handled in the next update? thanks.

1 Like

Thanks ! I had the same issue as @melee1313 and this fixed it.

As a side note, in my system the file you mention is called “/opt/letsencrypt/letsencrypt-auto” and not “/opt/letsencrypt/certbot-auto”

1 Like

Thank You!!! This worked like a charm

1 Like

It might automatically be fixed now by pip’s release: https://github.com/pypa/pip/pull/6185, which includes https://github.com/pypa/pip/pull/6171

We also plan to fix Certbot so that it won’t be affected should this happen again: https://github.com/certbot/certbot/issues/6685

So if you manually make the change now, future versions of Certbot will automatically incorporate the change, on our end.


Same error HERE!!!

and fixed with erica’s solution


1 Like

New install, Ubuntu 16.04 on AWS.
Installed letsencrypt by:

git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt

I added the “–no-download” fix to those 2 lines, still fails

Certbot has problem setting up the virtual environment.

We were not be able to guess the right solution from your pip

Suddenly, it worked!

Creating virtual environment…
Installing Python packages…
Installation succeeded.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.