Letsencrypt: certbot “No module named interface” error

The certbot-auto renewal has been running fine, but one day, I noticed it was giving me this error.

Traceback (most recent call last):
  File “/opt/eff.org/certbot/venv/bin/letsencrypt”, line 7, in
    from certbot.main import main
  File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/certbot/main.py”, line 9, in
    import zope.component
  File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/zope/component/__init__.py”,
    line 16, in from zope.interface import Interface
  ImportError: No module named interface

A quick google search led me to a couple of github links (#1, #2) where other users reported similar problems and various solutions.

After trying different suggestions, I’ve found a solution that worked for me.

What I first did was remove the local cache:

sudo rm -rf /root/.local/share/letsencrypt/
sudo rm -rf /opt/eff.org/certbot/

Tried renewing with certbot-auto –debug renew after that and got the same error.

So I tried manually upgrading certbot:

unset PYTHON_INSTALL_LAYOUT
/root/.local/share/letsencrypt/bin/pip install --upgrade certbot

After that, I ran the renewal command again: certbot-auto –debug renew, and it finally ran without any errors.

These were the only steps I took to resolve this issue on an Amazon Linux ec2 server with the latest updates.

You might need to restart httpd service if your certificate has been expired.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.