Can't update SSL certificate - /usr/lib/python3/dist-packages/requests/ RequestsDependencyWarning: urllib3 (1.26.11) or chardet (3.0.4) doesn't match a supported version!

OS type and version Ubuntu 20.04
Webmin version 2.001
Virtualmin version 7.3-1

After a recent update (not exactly sure when), my letsencrypt certificates can’t be renewed due to the following error:
/usr/lib/python3/dist-packages/requests/ RequestsDependencyWarning: urllib3 (1.26.11) or chardet (3.0.4) doesn’t match a supported version!

Not sure why this happened or what to do to resolve it.

Any suggestions would be appreciated.

Seems likely you’ve installed some Python packages (or certbot) from a source other than your OS repositories. The certbot package that is provided by Ubuntu works with the Python packages provided by the Ubuntu folks…so…something isn’t that on your system.

To expand on that, if you need to install any Python (Perl, Ruby, NodeJS, whatever) dependencies from sources other than your OS repos or repos that are compatible with your OS repos, it may be smartest to use a virtual environment for the purpose. Python provides virtualenv for building a self-contained directory of dependencies, and optionally a different Python version. Most languages have something similar.

Changing the system Python libraries outside control of the package manager is a high risk activity, extremely likely to break stuff you might not expect.

@Joe Thanks Joe. I don’t recall installing either Python or Certbot packages from another source. It’s possible an install script for something went ahead and did this and I wasn’t aware.

How can I best remove and reinstate the packages from the OS repositories only?