Ubuntu 18.04.6 ensurepip is not available

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:
test2.app.cefmed.com

I ran this command:
sudo python3 -m venv /opt/certbot/

It produced this output:
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

apt-get install python3-venv

You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/opt/certbot/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']

My web server is (include version):
apache

The operating system my web server runs on is (include version):
ubuntu@ip-172-31-4-60:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don't know):
yes
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
no
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):
ubuntu@ip-172-31-4-60:~$ certbot --version
Traceback (most recent call last):
File "/usr/bin/certbot", line 5, in
from certbot.main import main
ModuleNotFoundError: No module named 'certbot'

I have python3.7 installed. I resolved with command:
sudo apt-get install python3.7-venv

Please note that the Certbot team removed support for Python 3.7 in version 2.8.0 (certbot/certbot/CHANGELOG.md at master · certbot/certbot · GitHub). Currently the latest Certbot version is 3.2.0.

Also, where did /usr/bin/certbot come from if you didn't install Certbot using pip yet? Please note that it's not recommended to have multiple instances due to different methods of installing Certbot at the same time. The fact that /usr/bin/certbot still existed and tried to start Certbot somehow when you didn't have Certbot installed using pip makes me think there might be some left-over files from a previous installation method.

3 Likes

ubuntu-18.04 dropped out of the long-term-support window nearly 2 years ago.

if @salgados can not upgrade to a newer ubuntu, I suggest using the snapd distribution. snapd will use it's own python and is more likely to have updates.

2 Likes

Maybe OP is paying for Ubuntu Pro Support? :man_shrugging: