I am trying to simply renew my domains with this command: certbot --nginx renew
However, I am getting this error when I run the command:
Traceback (most recent call last):
File "/usr/local/bin/certbot", line 6, in <module>
from certbot.main import main
File "/usr/local/lib/python3.6/dist-packages/certbot/main.py", line 10, in <module>
import josepy as jose
File "/usr/lib/python3/dist-packages/josepy/__init__.py", line 41, in <module>
from josepy.interfaces import JSONDeSerializable
File "/usr/lib/python3/dist-packages/josepy/interfaces.py", line 7, in <module>
from josepy import errors, util
File "/usr/lib/python3/dist-packages/josepy/util.py", line 7, in <module>
import OpenSSL
File "/usr/local/lib/python3.6/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/local/lib/python3.6/dist-packages/OpenSSL/crypto.py", line 12, in <module>
from cryptography import x509
File "/usr/local/lib/python3.6/dist-packages/cryptography/x509/__init__.py", line 8, in <module>
from cryptography.x509.base import (
File "/usr/local/lib/python3.6/dist-packages/cryptography/x509/base.py", line 16, in <module>
from cryptography.x509.extensions import Extension, ExtensionType
File "/usr/local/lib/python3.6/dist-packages/cryptography/x509/extensions.py", line 13, in <module>
from asn1crypto.keys import PublicKeyInfo
ModuleNotFoundError: No module named 'asn1crypto'
I have tried to reinstall certbot and python but nothing has helped.
/usr/local/bin/certbot suggests that you have installed Certbot from pip. This is not a supported method of installation.
Remove the pip-installed Certbot installation and follow along the installation instructions for Ubuntu 20.04 from https://certbot.eff.org/, which is to install Certbot either from snap or apt.
You’ll want to remove the pip-installed one (/usr/local/bin/certbot) as well, as it is the one that is taking priority in your PATH.
The stuff that is installed from apt goes into /usr/bin/ and /usr/lib/, the conflicting pip binaries and libraries go into /usr/local/bin/ and /usr/local/lib/.
I think you might just be able to remove/disable the /usr/local/bin/certbot binary and everything will work.
If not, we’ll have to work through the individual library errors.
I’m having issues running pip, how can I manually change the path?
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip._internal import main
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/cmdoptions.py", line 14, in <module>
from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils.util'
I have disutils installed, I rather just change the path and not figure this random python issue out.
I’m not sure why you need to run pip. But again, that is not a pip that you installed from apt. It’s broken for approximately the same reason that your Certbot is broken - stuff installed outside of apt gets screwed up by major OS upgrades.
If you run this, does it work?
/usr/bin/certbot renew --dry-run
If it does, then all you need to do is remove the other Certbot binary from your path.
An unexpected error occurred:
pkg_resources.DistributionNotFound: The 'asn1crypto>=0.21.0' distribution was not found and is required by cryptography
Please see the logfile '/tmp/tmpa5t141qk/log' for more details.
And the log file reads:
2020-07-27 23:12:36,785:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
File "/usr/bin/certbot", line 11, in <module>
load_entry_point('certbot==0.40.0', 'console_scripts', 'certbot')()
File "/usr/lib/python3/dist-packages/certbot/main.py", line 1348, in main
plugins = plugins_disco.PluginsRegistry.find_all()
File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 208, in find_all
plugin_ep = PluginEntryPoint(entry_point)
File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 50, in __init__
self.plugin_cls = entry_point.load()
File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2345, in load
self.require(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2368, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 784, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'asn1crypto>=0.21.0' distribution was not found and is required by cryptography