I ran this command: apt-get install certbot python-certbot-nginx -t stretch-backports
It produced this output: Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
certbot : Depends: python3-certbot (= 0.28.0-1~bpo9+1) but it is not going to be installed
Depends: python3:any
python-certbot-nginx : Depends: python3-certbot-nginx but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
My web server is (include version): nginx version: nginx/1.10.3
The operating system my web server runs on is (include version): Debian Stretch 9.9
My hosting provider, if applicable, is: RFI
I can login to a root shell on my machine (yes or no, or I don’t know): yes
I’m using a control panel to manage my site (no, or provide the name and version of the control panel): No
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): certbot --version
-bash: /usr/bin/certbot: No such file or directory
apt -f install
Reading package lists… Done
Building dependency tree
Reading state information… Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
. The other way to tease the errors out is to recursively try to install the reported dependencies and seeing why they refuse to install. So for example,
apt-get install certbot python-certbot-nginx -t stretch-backports
…
python-certbot-nginx : Depends: python3-certbot-nginx but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
apt install python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python3 : PreDepends: python3-minimal (= 3.5.3-1) but it is not going to be installed
Depends: python3.5 (>= 3.5.3-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@mythic:/etc/apt# apt-get install certbot python-certbot-nginx -t stretch-backports
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
certbot : Depends: python3-certbot (= 0.28.0-1~bpo9+1) but it is not going to be installed
Depends: python3:any
python-certbot-nginx : Depends: python3-certbot-nginx but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@mythic:/etc/apt# apt-get install certbot python-certbot
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package python-certbot is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package ‘python-certbot’ has no installation candidate
root@mythic:/etc/apt# apt-get install certbot python3-certbot
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
certbot : Depends: python3:any
python3-certbot : Depends: python3-acme (>= 0.26.0~) but it is not going to be installed
Depends: python3-requests (>= 2.4.3) but it is not going to be installed
Depends: python3-configargparse (>= 0.10.0) but it is not going to be installed
Depends: python3-configobj but it is not going to be installed
Depends: python3-cryptography (>= 1.2) but it is not going to be installed
Depends: python3-josepy but it is not going to be installed
Depends: python3-mock but it is not going to be installed
Depends: python3-parsedatetime but it is not going to be installed
Depends: python3-pkg-resources but it is not going to be installed
Depends: python3-rfc3339 but it is not going to be installed
Depends: python3-tz but it is not going to be installed
Depends: python3-zope.component but it is not going to be installed
Depends: python3-zope.interface but it is not going to be installed
Depends: python3:any (>= 3.3.2-2~)
E: Unable to correct problems, you have held broken packages.
root@mythic:/etc/apt#
root@mythic:/etc/apt#
root@mythic:/etc/apt# apt-get install certbot python3
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python3 : PreDepends: python3-minimal (= 3.5.3-1) but it is not going to be installed
Depends: python3.5 (>= 3.5.3-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@mythic:/etc/apt# apt-get install certbot python3.5
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
certbot : Depends: python3-certbot (= 0.28.0-1~deb9u2) but it is not going to be installed
Depends: python3:any
python3.5 : Depends: python3.5-minimal (= 3.5.3-1+deb9u1) but it is not going to be installed
Depends: libpython3.5-stdlib (= 3.5.3-1+deb9u1) but 3.5.4-2 is to be installed
E: Unable to correct problems, you have held broken packages.
root@mythic:/etc/apt# apt-get install certbot libpython3.5-stdlib
Reading package lists… Done
Building dependency tree
Reading state information… Done
libpython3.5-stdlib is already the newest version (3.5.4-2).
libpython3.5-stdlib set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
certbot : Depends: python3-certbot (= 0.28.0-1~deb9u2) but it is not going to be installed
Depends: python3:any
E: Unable to correct problems, you have held broken packages.
Showing my ignorance of apt-get here perhaps, but this looks like apt-get is saying we have the latest version of libypthon3.5-stdlib, but we're not going to use it...?
Depends: python3:any
python3.5 : Depends: python3.5-minimal (= 3.5.3-1+deb9u1) but it is not going to be installed
Depends: libpython3.5-stdlib (= 3.5.3-1+deb9u1) but 3.5.4-2 is to be installed
E: Unable to correct problems, you have held broken packages.
I agree that this is probably, at least in part, your dependency problem. Any other third-party Python software installed on this server?
I’m not sure how to resolve this, but you might consider trying certbot-auto, which uses virtual environments and doesn’t rely so much on your OS packages (though it still does a little bit).
I removed the errant library via: apt-get remove libpython3.5-minimal (which was where that 3.5.4-2 came from), then I was able to install as normal. Problem solved.
FYI. to anyone else looking at this thread. The solution (and _az's suggestions) demonstrated that the problem was an erroneously installed (mis-matching versions) python3 library package, and had nothing to do with certbot at all. certbot was just the unlucky end program that exposed the problem.
Many thanks for your clarity in helping me find the solution!