Certbot – Attempting to renew cert produced an unexpected error- Ubuntu 20.04

manual-auth-hook command "/etc/letsencrypt/acme-dns-auth.py" returned error code 1
Error output from manual-auth-hook command acme-dns-auth.py:
Traceback (most recent call last):
  File "/etc/letsencrypt/acme-dns-auth.py", line 4, in 
    import requests
  File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 113, in 
    from . import packages
  File "/usr/local/lib/python2.7/dist-packages/requests/packages.py", line 7, in 
    locals()[package] = __import__(package)
ImportError: No module named idna

The issue is caused by the “acme-dns-auth.py” using the wrong version of Python.

First make sure that you have the prerequisite installed:
apt install python3-pip

Open the “acme-dns-auth.py” file and update the first line to look like:
#!/usr/bin/env python3

Now run the renew script
certbot renew