Certbot shows import error

The log you've shown shows Certbot 1.21.0 which is far from the latest release. It might be the latest version available for Ubuntu 22.04 using their own package manager, but that's a different story. Certbot advises to use "snap" to install Certbot nowadays, see Certbot Instructions | Certbot (it says Ubuntu 20, but can also be used for 22).

Now, with regard to your issue: it seems you've installed the third-party plugin certbot-django using pip. It's also that third-party plugin that generates the error with regard to the asymmetric-jwt-auth package and not Certbot itself. Certbot doesn't rely on that package.

So it's probably a better idea to make an issue at the certbot-django plugins support channel. Although I must say installing packages using pip globally can easily lead to misconfigured versions. So it might also help to update all pip packages?

Looking at the plugin and jwt package a little bit further, it seems the django plugin relies on version 0.4.1 or later of the jwt library, but in version 1.0.0 the entire asymmetric_jwt_auth package was refactored, back in 2021:

And with that refactoring the create_auth_header function wasn't available any longer globally.

The django plugin however hasn't been updated (content-related) for 5 years now. So personally I'd consider the certbot-django plugin DEAD and I would advice against using it. (Although weirdly enough the person committing the most recent commits is still quite active on Github: crgwbr (Craig Weber) · GitHub. Therefore I opened an issue on Github: Plugin fails with recent versions of asymmetric-jwt-auth · Issue #2 · thelabnyc/certbot-django · GitHub)

6 Likes