Pip installed cloudflare plugin not available vi

I'm attempting to create a docker image which contains certbot.

I can't use the official certbot image as the container contains other components.

I'm trying to test the install process on my local PC running ubuntu 21.10

I"ve run the following commands:

apt install --no-install-recommends -y python3 python3.9-venv
python3 -m venv /opt/certbot/
/opt/certbot/bin/pip install --upgrade pip
/opt/certbot/bin/pip install certbot
ln -s /opt/certbot/bin/certbot /usr/bin/certbot
pip install certbot-dns-cloudflare

The above commands all run to completion with no errors.

The problem is that when I run certbot plugins it doesn't list the cloudflare plugin

certbot plugins
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* standalone
Description: Spin up a temporary webserver
Interfaces: Authenticator, Plugin
Entry point: standalone = certbot._internal.plugins.standalone:Authenticator

* webroot
Description: Place files in webroot directory
Interfaces: Authenticator, Plugin
Entry point: webroot = certbot._internal.plugins.webroot:Authenticator
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

certbot --version
certbot 1.20.0

Certbot is installed at:

/opt/certbot/bin/certbot

What have I done wrong?

Hi there,

From this page, the instruction to install the plugin is:

sudo /opt/certbot/bin/pip install certbot-dns-cloudflare

From your post, you have installed the plugin using global pip, which would not make the plugin available inside the Python virtual environment.

Or activate the specific certbot venv.

2 Likes

So I'm not a python person.

If I activate the environment do I need to activate it each time I run certbot or just during the install?

The activation of the venv is just for making sure any pip execution is being done "inside" the venv and not on your global system. It's not a requirement, but is very helpful when executing multiple pip commands for example. If you don't activate the venv, you need to make sure you execute the correct pip, as instructed by @_az above.

The certbot command in /usr/bin/certbot is actually a symbolic link to the certbot script inside the venv, so that doesn't require activating the venv.

3 Likes

When I check the certbot commands they all link to the same instance:

dwhich certbot
Found at: /usr/bin/certbot
Found at: /bin/certbot
ls -la /bin/certbot

/bin/certbot -> /opt/certbot/bin/certbot
ls -la /usr/bin/certbot
/usr/bin/certbot -> /opt/certbot/bin/certbot

I dunno about /bin/certbot (where it came from), but you should be good to go with or without the venv when executing certbot :slight_smile:

2 Likes

I think I worked it out.

_az instructions as to the pip path was the clue.

For the record the full set of commands are:

apt install --no-install-recommends -y python3 python3.9-venv
python3 -m venv /opt/certbot/
/opt/certbot/bin/pip install --upgrade pip
/opt/certbot/bin/pip install certbot
ln -s /opt/certbot/bin/certbot /usr/bin/certbot
/opt/certbot/bin/pip install certbot-dns-cloudflare

Not being a python person I didn't realise that:
python3 -m venv /opt/certbot/

Creates a directory /opt/certbot and installs a custom version of python which we then
install certbot into.

I saw documentation stating that installing certbot from pip only works in a virtual environment but assumed they meant something like docker.

The certbot install documentation needs some work and a few less assumptions.

Appreciate everyone's help.

2 Likes

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