Certbot installation issues

My domain is:
he.metavision.institute

I ran this command:
certbot --nginx certonly
certbot certonly --webroot --webroot-path=/var/www/metavision.institute -d he.metavision.institute

It produced this output:
-bash: /usr/local/bin/certbot: No such file or directory

My web server is (include version):
nginx 1.10.3

The operating system my web server runs on is (include version):
ubuntu 16.04

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/local/bin/certbot: No such file or directory

apt install certbot python-certbot-nginx

certbot is already the newest version (0.31.0-1+ubuntu16.04.1+certbot+1).
python-certbot-nginx is already the newest version (0.31.0-1+ubuntu16.04.1+certbot+1).

it is available at /usr/bin/certbot however that produces
~# /usr/bin/certbot --version
Traceback (most recent call last):
File “/usr/bin/certbot”, line 11, in
load_entry_point(‘certbot==0.31.0’, ‘console_scripts’, ‘certbot’)()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 561, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2631, in load_entry_point
return ep.load()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2291, in load
return self.resolve()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2297, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 14, in
from acme.magic_typing import Union # pylint: disable=unused-import, no-name-in-module
ModuleNotFoundError: No module named ‘acme.magic_typing’

I think it may be because of incompatibility between apt installed certbot and python certbot or something?

starting again -------

root@eos:~# dpkg -S certbot
dpkg-query: no path found matching pattern certbot

root@eos:~# apt install letsencrypt
Reading package lists… Done
Building dependency tree
Reading state information… Don
The following package was automatically installed and is no longer required:
python3-pyparsing
Use ‘apt autoremove’ to remove it.
The following additional packages will be installed:
certbot python3-certbot
Suggested packages:
python3-certbot-apache python3-certbot-nginx python-certbot-doc
The following NEW packages will be installed:
certbot letsencrypt python3-certbot
0 upgraded, 3 newly installed, 0 to remove and 5 not upgraded.
Need to get 0 B/226 kB of archives.
After this operation, 1,288 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Selecting previously unselected package python3-certbot.
(Reading database … 46072 files and directories currently installed.)
Preparing to unpack …/python3-certbot_0.31.0-1+ubuntu16.04.1+certbot+1_all.deb …
Unpacking python3-certbot (0.31.0-1+ubuntu16.04.1+certbot+1) …
Selecting previously unselected package certbot.
Preparing to unpack …/certbot_0.31.0-1+ubuntu16.04.1+certbot+1_all.deb …
Unpacking certbot (0.31.0-1+ubuntu16.04.1+certbot+1) …
Selecting previously unselected package letsencrypt.
Preparing to unpack …/letsencrypt_0.31.0-1+ubuntu16.04.1+certbot+1_all.deb …
Unpacking letsencrypt (0.31.0-1+ubuntu16.04.1+certbot+1) …
Processing triggers for man-db (2.7.5-1) …
Setting up python3-certbot (0.31.0-1+ubuntu16.04.1+certbot+1) …
Setting up certbot (0.31.0-1+ubuntu16.04.1+certbot+1) …
certbot.service is a disabled or a static unit, not starting it.
Setting up letsencrypt (0.31.0-1+ubuntu16.04.1+certbot+1) …

root@eos:~# certbot
-bash: /usr/local/bin/certbot: No such file or directory

root@eos:~# letsencrypt

Traceback (most recent call last):
File “/usr/bin/letsencrypt”, line 11, in
load_entry_point(‘certbot==0.31.0’, ‘console_scripts’, ‘certbot’)()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 561, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2631, in load_entry_point
return ep.load()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2291, in load
return self.resolve()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2297, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 14, in
from acme.magic_typing import Union # pylint: disable=unused-import, no-name-in-module
ModuleNotFoundError: No module named ‘acme.magic_typing’

root@eos:~# dpkg -S certbot
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins
python3-certbot: /usr/lib/python3/dist-packages/certbot/lock.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/dns_test_common_lexicon.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/csr-san_512.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/enhancements.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/display/util_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/storage_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/ssl-dhparams.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/configuration_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/error_handler.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/util.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/util.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/display/ops.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/display/init.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/client_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/storage.py
python3-certbot: /usr/lib/python3/dist-packages/certbot-0.31.0.egg-info
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/util_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/compat_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/auth_handler_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/cert-5sans_512.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/display/util.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/cli.ini
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/common.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/compat.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/common_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/display/init.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/manual.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/csr-nonames_512.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/csr_512.der
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/main_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/account_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/cert-nosans_nistp256.pe
certbot: /usr/share/doc/certbot/changelog.Debian.gz
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/README
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/util_test.py
python3-certbot: /usr/share/doc/python3-certbot/copyright
python3-certbot: /usr/lib/python3/dist-packages/certbot/display/dummy_readline.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/ocsp.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/configuration.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/display/enhancements.py
python3-certbot: /usr/share/lintian/overrides/python3-certbot
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/sample-archive/cert1.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/log_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/init.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/display/enhancements_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/crypto_util_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/storage_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/standalone.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/sample-archive/fullchain1.pe
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/display/completer_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/dns_common_lexicon_test.py
python3-certbot: /usr/share/doc/python3-certbot/changelog.Debian.gz
python3-certbot: /usr/share/doc/python3-certbot
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/reverter_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/main.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/account.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/error_handler_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/sample-renewal-ancient.conf
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/reporter_test.p
python3-certbot: /usr/lib/python3/dist-packages/certbot/display/completer.p
python3-certbot: /usr/lib/python3/dist-packages/certbot/interfaces.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/errors.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/cert_manager_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/dns_common_test.p
certbot: /lib/systemd/system/certbot.timer
certbot: /usr/share/doc/certbot
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/standalone_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/dns_common.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/sample-archive/chain1.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/cli.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/null.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/notify_test.p
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/ocsp_test.py
certbot: /usr/bin/certbot
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/cert_fullchain_2048.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/disco.py
certbot: /etc/logrotate.d/certbot
python3-certbot: /usr/lib/python3/dist-packages/certbot-0.31.0.egg-info/dependency_links.txt
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/cert_2048.pem
certbot: /lib/systemd/system/certbot.service
python3-certbot: /usr/lib/python3/dist-packages/certbot/crypto_util.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/achallenges.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/csr-nosans_512.conf
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/sample-archive/privkey1.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/webrootconftest.ini
python3-certbot: /usr/lib/python3/dist-packages/certbot/util.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/init.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/selection_test.py
certbot: /usr/share/doc/certbot/README.rst.gz
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/manual_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/lock_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/csr-nosans_512.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/updater.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/hook_test.pypython3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/cert-san_512.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/display
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/csr_512.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/rsa2048_key.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/rsa512_key.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/cli_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/log.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/reverter.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/csr-6sans_512.conf
python3-certbot: /usr/lib/python3/dist-packages/certbot
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/webroot.py
certbot: /usr/share/doc/certbot/copyright
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/display
python3-certbot: /usr/lib/python3/dist-packages/certbot/init.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/sample-renewal.conf
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/disco_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/eff_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/cert_512.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/eff.py
python3-certbot: /usr/lib/python3/dist-packages/certbot-0.31.0.egg-info/PKG-INFO
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/enhancements_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/null_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/notify.py
python3-certbot: /usr/lib/python3/dist-packages/certbot-0.31.0.egg-info/top_level.txt
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/csr-6sans_512.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/sample-archive
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/selection.py
python3-certbot: /usr/lib/python3/dist-packages/certbot-0.31.0.egg-info/requires.txt
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/storage.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/renewal.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/constants.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/csr-nosans_nistp256.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/auth_handler.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/dns_test_common.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/renewupdater_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/acme_util.py
python3-certbot: /usr/lib/python3/dist-packages/certbot-0.31.0.egg-info/entry_points.txt
python3-certbot: /usr/lib/python3/dist-packages/certbot/cert_manager.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/hooks.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/reporter.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/renewal_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/dns_common_lexicon.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/client.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/plugins/webroot_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/errors_test.py
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/os-release
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/cert_512_bad.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/rsa256_key.pem
certbot: /etc/cron.d/certbot
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/testdata/nistp256_key.pem
python3-certbot: /usr/lib/python3/dist-packages/certbot/tests/display/ops_test.py

Looks like you have installed Certbot from two different places.

/usr/local/bin/certbot is what you get if you install Certbot from pip or python setup.py install (git). You don’t want that, because it messes up your system’s global Python libraries.

/usr/bin/certbot is what you get from installing Certbot from the Ubuntu PPA. That’s the one we want.

What you probably need to do is remove the packages (and relevant dependencies) you installed from pip, which is a bit tricky. There’s no “rollback” operation, it’s all gotta be by hand. If this is a fresh server, starting again could be easier.

pip3 uninstall certbot certbot-nginx acme
apt install --reinstall python3-certbot-nginx python3-acme python3-certbot certbot
2 Likes

Thanks for your help!

It turns out that pip3 was looking at the wrong interpreter, so pip list showed as if those packages were not installed, fixing the pip3 command allowed the uninstall to happen.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.