Certbot python error


#1

Hi,

one of my VMs (which has been installed for quite a while) was still using the old letsencrypt client … due to the old protocol being phased out, I removed the old client and tried to use certbot instead … anyway, I get the following error:

An unexpected error occurred:
TypeError: init() got an unexpected keyword argument ‘allow_abbrev’
Please see the logfile ‘/tmp/tmppzmt7437’ for more details.

The logfile has this contents:

2019-01-18 15:05:27,314:DEBUG:certbot.main:certbot version: 0.28.0
2019-01-18 15:05:27,317:DEBUG:certbot.main:Arguments:
2019-01-18 15:05:27,318:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2019-01-18 15:05:27,319:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
File “/usr/bin/certbot”, line 11, in
load_entry_point(‘certbot==0.28.0’, ‘console_scripts’, ‘certbot’)()
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 1317, in main
args = cli.prepare_and_parse_args(plugins, cli_args)
File “/usr/lib/python3/dist-packages/certbot/cli.py”, line 894, in prepare_and_parse_args
helpful = HelpfulArgumentParser(args, plugins, detect_defaults)
File “/usr/lib/python3/dist-packages/certbot/cli.py”, line 522, in init
" and ".join(flag_default(“config_files”))))
File “/usr/lib/python3/dist-packages/configargparse.py”, line 367, in init
argparse.ArgumentParser.init(self, **kwargs_for_super)
TypeError: init() got an unexpected keyword argument ‘allow_abbrev’
2019-01-18 15:05:27,319:ERROR:certbot.log:An unexpected error occurred:

On another server, which has the same Ubuntu 16.04.5 LTS running, and which has never had the old letsencrypt but just the certbot install, everything works fine … I checked the certbot related packages, and they all seem to be the same release version …

As I’m not a Python programmer, I’m somewhat at a loss on how to get Certbot running … any idea what the cause for this could be?


#2

FYI - remove certbot and tried certbot-auto, this worked fine albeit had some problems with the old configs for Apache … anyway, everything seems to be working fine …
I suspect the problem is caused by some python library replaced by the Certbot repository … (which I just read about on here …)


#4

This issue seems odd.

allow_abbrev was added in Python 3.5.

The only way for it to not exist in argparse should be if you’ve installed a second, older Python 3, or a second, older copy of the argparse module.

(The latter is easy to do with pip, according to a bug comment.)

The Certbot PPA packages a newer version of python3-configargparse than Ubuntu (0.11.0 vs. 0.10.0). That is – probably no coincidence – the version that adds Python 3.5 and allow_abbrev support.

But if the issue is that ConfigArgParse is too old to support allow_abbrev, I would’ve expected a different traceback.

certbot-auto is probably using Python 2.7. Plus it uses a virtualenv, which would probably dodge this kind of issue.

Can you check what Python certbot was using?

head -1 /usr/bin/certbot

And run that Python and see what version it is and what modules it uses? E.g.:

sudo /usr/bin/python3 -V
sudo /usr/bin/python3 -c "import argparse, configargparse; print(argparse); print(configargparse)"

And see what Python 3s there are? E.g.:

sudo which -a python3 python3.{0..7}

And also what version of ConfigArgParse is installed?

dpkg -l python3-configargparse

Edit: Fix the last command.