ImportError: No module named enum

I ran this command: certbot

It produced this output:
File "/usr/local/bin/certbot", line 7, in

  • from certbot.main import main*
  • File "/usr/local/lib/python2.7/dist-packages/certbot/main.py", line 10, in *
  • import josepy as jose*
  • File "/usr/local/lib/python2.7/dist-packages/josepy/init.py", line 44, in *
  • from josepy.interfaces import JSONDeSerializable*
  • File "/usr/local/lib/python2.7/dist-packages/josepy/interfaces.py", line 8, in *
  • from josepy import errors, util*
  • File "/usr/local/lib/python2.7/dist-packages/josepy/util.py", line 4, in *
  • import OpenSSL*
  • File "/usr/local/lib/python2.7/dist-packages/OpenSSL/init.py", line 8, in *
  • from OpenSSL import crypto, SSL*
  • File "/usr/local/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 12, in *
  • from cryptography import x509*
  • File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/init.py", line 7, in *
  • from cryptography.x509 import certificate_transparency*
  • File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/certificate_transparency.py", line 8, in *
  • from enum import Enum*
    ImportError: No module named enum

My web server is (include version): Apache

The operating system my web server runs on is (include version): Ubuntu 20.04

I can login to a root shell on my machine (yes or no, or I don't know): Yes

1 Like

Hi @ryoung,

This can happen if you try to install Certbot to your system using pip. There is a warning against doing so in the documentation. It can easily break due to the way Linux systems manage Python packages.

The best way to install Certbot is to use the instructions from https://certbot.eff.org/instructions. You may want to remove the /usr/local/bin/certbot file so that it does not interfere with the working installation.

1 Like

Unfortunately I didn't install with pip, but with apt.

However, once I uninstalled everything I was able to run the certbot command from the user/bin.

Thanks!

2 Likes

Cool!

/usr/bin/certbot comes from apt, but /usr/local/bin/certbot definitely comes from pip.

I think the /usr/local/bin/ has priority in your path on Ubuntu; it may have been taking priority over the one from apt.

Glad to hear you got it working.

1 Like

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