Can I specify the python version when running "certbot-auto" command?

I am using a third-party script named "letsencrypt-vesta" to automate the process of applying and renewing LE certificates on my VestaCP panel.

From the code of letsencrypt-vesta script, I can see that it uses certbot-auto command:

LETSENCRYPT_COMMAND='/usr/local/certbot/certbot-auto -t --renew-by-default --agree-tos --webroot -w /etc/letsencrypt/webroot --server https://acme-v01.api.letsencrypt.org/directory'

Well, we know that Ubuntu Server 16.04.2 already installed both python 2.7 and python 3.5, while v2.7 is the default one. I can confirm this by running following command on my SSH client:

root@ubuntu:~# python -V
Python 2.7.12
root@ubuntu:~# python3 -V
Python 3.5.2

However, if I run letsencrypt-vesta script directly, it will end up with following error:

OSError: Command /opt/eff.org/certbot/venv/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code 2
Let's Encrypt returned an error status. Aborting.

The solution was introduced here:

That is , just remove python3 completely, then letsencrypt-vesta will work smoothly.

But, I have a different oppinion:

We know that, Certbot already supports python3 .

So, why we need to remove python 3 ? Why not just let certbot-auto command choose to use python3 instead?

Now, I final question is:

Can I specify the python version (python3) when running "certbot-auto" command?

Or :

How to let certbot-auto command choose to use python 3 when the system default python version is 2.7?

Thank you.

I’m not sure whether it will fix your problem but you can nominate the Python version to use:

LE_PYTHON=python2.7 ./cerbot-auto
LE_PYTHON=python3 ./cerbot-auto
# etc ...

However it will still use the 2.7 from virtualenv in the end so I’m not too sure about this being helpful.

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