Certbot running error

Somehow my certbot installation got broken, I got the following error when running certbot:

I ran this command:

$ certbot --version

It produced this output:

An unexpected error occurred:
pkg_resources.VersionConflict: (requests 2.27.1 (/snap/certbot/2192/lib/python3.8/site-packages), Requirement.parse('requests~=2.28'))
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /tmp/tmp4mvcnzyr/log or re-run Certbot with -v for more details.

logfile:

2022-08-19 22:45:25,674:DEBUG:urllib3.connectionpool:http://localhost:None "GET /v2/connections?snap=certbot&interface=content HTTP/1.1" 200 790
2022-08-19 22:45:26,872:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
  File "/snap/certbot/2192/bin/certbot", line 8, in <module>
    sys.exit(main())
  File "/snap/certbot/2192/lib/python3.8/site-packages/certbot/main.py", line 19, in main
    return internal_main.main(cli_args)
  File "/snap/certbot/2192/lib/python3.8/site-packages/certbot/_internal/main.py", line 1705, in main
    plugins = plugins_disco.PluginsRegistry.find_all()
  File "/snap/certbot/2192/lib/python3.8/site-packages/certbot/_internal/plugins/disco.py", line 241, in find_all
    plugin_ep = cls._load_entry_point(entry_point, plugins, with_prefix=False)
  File "/snap/certbot/2192/lib/python3.8/site-packages/certbot/_internal/plugins/disco.py", line 261, in _load_entry_point
    plugin_ep = PluginEntryPoint(entry_point, with_prefix)
  File "/snap/certbot/2192/lib/python3.8/site-packages/certbot/_internal/plugins/disco.py", line 60, in __init__
    self.plugin_cls: Type[interfaces.Plugin] = entry_point.load()
  File "/snap/certbot/2192/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2457, in load
    self.require(*args, **kwargs)
  File "/snap/certbot/2192/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2480, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/snap/certbot/2192/lib/python3.8/site-packages/pkg_resources/__init__.py", line 788, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (requests 2.27.1 (/snap/certbot/2192/lib/python3.8/site-packages), Requirement.parse('requests~=2.28'))
2022-08-19 22:45:26,872:ERROR:certbot._internal.log:An unexpected error occurred:
2022-08-19 22:45:26,872:ERROR:certbot._internal.log:pkg_resources.VersionConflict: (requests 2.27.1 (/snap/certbot/2192/lib/python3.8/site-packages), Requirement.parse('requests~=2.28'))

The operating system my web server runs on is (include version):
ubuntu 20.04.

I can login to a root shell on my machine (yes or no, or I don't know):
yes


I haven't changed anything on the system, maybe an auto update.
I don't know exactly when the problem occurred, anyway the last successful cert update was in June.

How can I solve the issue?

Hello @malof22542, welcome to the Let's Encrypt community. :slightly_smiling_face:

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:

I ran this command:

It produced this output:

My web server is (include version):

The operating system my web server runs on is (include version):

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don't know):

I'm using a control panel to manage my site (no, or provide the name and version of the control panel):

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):

Thank you for assisting us in helping YOU!

Thank you Bruce5051, I edited the first post with the applicable fields.
Domain, web server, hosting and other info are not applicable and not related with the issue.

Difficult to say without knowing exactly what broke it.
I'd, nonetheless, try uninstalling certbot (all installs) and then reinstall it via instructions at:

@certbot-devs Weird error if you ask me! Shouldn't the certbot snap come bundled with its own requests?

This could be an issue with a snapped plugin, possibly. Right now I don't know how the Certbot snap on its own would be behaving like this.

What's the full output of:

snap list

I don't know if it's possible, but it would be helpful if Certbots trace would include the name of the module which throws this dependency error. Could such a thing be build, perhaps by catching the exception somewhere?

Ok, maybe I found the the fault plugin.

I made a fresh install and everything worked successful, then I installed certbot-dns-duckdns plugin (also via snap) and the error appeared again.

Did you follow the duckdns plug-in instructions here:

Yes, followed the instructions and after executing:

sudo snap connect certbot:plugin certbot-dns-duckdns

certbot stop working with the dependency conflict error reported in the first post.

Hmm. That was my only idea :slight_smile:

You might try asking on the github for duckdns. Or, maybe even on the github for certbot. Hopefully _az (a certbot dev) who posted earlier will have insight or even another volunteer here. The githubs will draw in a wider audience for this strange error.

Could be as simple as follows:

Although I don't have enough knowledge of snap and/or the exact method of Certbot for their dependencies in the snap, it might be a reason why your snap is complaining, if your certbot-dns-duckdns plugin is version 1.0.

Is it possible to downgrade your certbot-dns-duckdns plugin to version 0.9 with snap?

I've opened Relax `requests` version requirement to avoid crashing Certbot snap · Issue #117 · infinityofspace/certbot_dns_duckdns · GitHub. I think Dependabot's suggestions are a bit too aggressive for Certbot plugins.

I've already requested easing up the compatible release clause of the packages dependency on requests in the past due to Python errors outside snap because Gentoo didn't package a certain older version of requests any longer.

I guess snap is a little bit more picky even.

The new version 1.1 of certbot-dns-duckdns plugin has fixed the issue.
Thank you very much for the assistance