Debian server unable to run Certbot

root@vps434142:~# certbot 
Traceback (most recent call last):
  File "/usr/bin/certbot", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3017, in <module>
    @_call_aside
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3030, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 659, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 967, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 853, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'certbot==0.28.0' distribution was not found and is required by the application

Solution 1:

Please note that the information you have given is very scarce and I am guessing here. Nevertheless I will try to help you.

Based on your answer(python 3.5) I am guessing that you are on debian stretch and not buster.

I would try to reinstall python3 and certbot and see if that helps:

apt-get update
apt-get upgrade
apt-get install --reinstall python3
apt-get install --reinstall certbot

If that doesn't help, you could try to install certbot via pip:

apt-get remove certbot
apt-get install python3-pip
pip3 install certbot