Certbot failing "No module named 'pkg_resources' "

Creating a bug report/issue

Required Information

  • DietPi version | 8.5.1
  • Distro version | buster
  • Kernel version | 4.19.0-20-amd64 #1 SMP Debian 4.19.235-1 (2022-03-17) x86_64 GNU/Linux
  • SBC model | Native PC (x86_64)

Additional Information (if applicable)

  • Software title | Certbot
  • Was the software title installed freshly or updated/migrated? → migrated and fresly installed

Steps to reproduce

  1. Install certbot via dietpi-software
  2. Run certbot

Expected behaviour

  • certbot runs normal

Actual behaviour

root@MyServer:~# certbot
Traceback (most recent call last):
  File "/usr/bin/certbot", line 6, in <module>
    from pkg_resources import load_entry_point
ModuleNotFoundError: No module named 'pkg_resources'

Extra details

I got an expired certificate error when I connected to the server.
I tried to start the certbot and got an error.
I tried reinstalling certbot with no success.
Following advice from the internet, I tried apt install python3-setuptools. But it’s already installed.

After upgrading from debian 9 to 10. I couldn’t run the deluge torrent client because it didn’t find some python packages. Maybe it’s somehow related.

root@MyServer:~# python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pkg_resources import load_entry_point
>>>
root@MyServer:~# python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pkg_resources import load_entry_point
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pkg_resources'
>>>

Solved by upgrade setuptools up to 62.3.2

pip3 install --upgrade setuptools