letsencrypt failed with ImportError: No module named interface
Asked Answered
K

5

6

I'm using Amazon linux, and I followed some steps for using letsencrypt that easily found in google search, but all it fails with:

Error: couldn't get currently installed version for /root/.local/share/letsencrypt/bin/letsencrypt: 
Traceback (most recent call last):
  File "/root/.local/share/letsencrypt/bin/letsencrypt", line 7, in <module>
    from certbot.main import main
  File "/root/.local/share/letsencrypt/local/lib/python2.7/dist-packages/certbot/main.py", line 11, in <module>
    import zope.component
  File "/root/.local/share/letsencrypt/local/lib/python2.7/dist-packages/zope/component/__init__.py", line 16, in <module>
    from zope.interface import Interface
ImportError: No module named interface

What I do is:

# git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
# /opt/letsencrypt/letsencrypt-auto --debug

That's it. So I tried to fix this, but dozens of solution that I found all won't worked to me.

Most of them said try this:

unset PYTHON_INSTALL_LAYOUT

But still got same error, nothing changes. And someone said that type this:

pip install --upgrade pip

But after typed that, I can't use pip anymore, it failed with some kind of command not found error, so I had recreated my server again.

I also tried to use CertBot, but it gives me exactly same error!

I'm using Linux 4.4.51-40.58.amzn1.x86_64 x86_64, need a help. I spent almost a day, but nothing progressed.

Every solution that I was found were not worked to me. Any advice will very appreciate it.

Karlmarxstadt answered 11/3, 2017 at 10:21 Comment(1)
Possible duplicate of Letsencrypt ImportError: No module named interface on amazon linux while renewingEunaeunice
S
5

I had same issue and after a long run, a very simple thing solved this issue on my AWS instance:

  1. Move the letsencrypt cache files to another folder (considering you run it as root/sudo):

    sudo mv /root/.local/share/letsencrypt /root/.local/share/letsencrypt-old

  2. Downloaded a brand new version of letsencrypt

    git clone https://github.com/letsencrypt/letsencrypt

  3. Run the letsencrypt command to test if its working again:

    sudo ./letsencrypt-auto --debug

During my search for a solution I also updated pip which might have helped. Although my attempts after pip update did not solved my issue in the same way as cleaning up the letsencnrypt cache folder.

I hope this helps. If not, some links I can share about same issue:

Strawser answered 24/4, 2017 at 17:9 Comment(1)
does not help, still have the same issueAnew
P
13

Removing certbot directory did the trick for me.

rm -rf /opt/eff.org/certbot/

wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
sudo ./certbot-auto certonly --standalone -d example.com --no-bootstrap
Piccolo answered 4/11, 2017 at 9:32 Comment(0)
S
5

I had same issue and after a long run, a very simple thing solved this issue on my AWS instance:

  1. Move the letsencrypt cache files to another folder (considering you run it as root/sudo):

    sudo mv /root/.local/share/letsencrypt /root/.local/share/letsencrypt-old

  2. Downloaded a brand new version of letsencrypt

    git clone https://github.com/letsencrypt/letsencrypt

  3. Run the letsencrypt command to test if its working again:

    sudo ./letsencrypt-auto --debug

During my search for a solution I also updated pip which might have helped. Although my attempts after pip update did not solved my issue in the same way as cleaning up the letsencnrypt cache folder.

I hope this helps. If not, some links I can share about same issue:

Strawser answered 24/4, 2017 at 17:9 Comment(1)
does not help, still have the same issueAnew
B
3

Part of the issue for me was related to some strange default behavior around 64 bit packages installing, but not being picked up by python. After getting this issue [it's mostly installed at this point], run the following

cd /root/.local/share/letsencrypt
\cp -r ./venv/lib64/* ./venv/lib/

Then retry the command. The install locations of the python virtual environment change with different versions and operating systems, but the general principle has helped me debug two different installs.

Bonney answered 8/9, 2017 at 21:18 Comment(0)
B
2

I have also faced this issue multiple times and every time I have to repeat these following steps:

Remove cache:

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

then,

unset PYTHON_INSTALL_LAYOUT

Install Let’s Encrypt by cloning the github repository into /opt/letsencrypt

git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt

then run installer again

/opt/letsencrypt/letsencrypt-auto --debug

these steps always works for me.

Bergmann answered 19/12, 2019 at 13:28 Comment(0)
D
0

I solved it following the next steps

  1. Download certbot-auto by going to this link.

  2. Delete letsencrypt folder:

    sudo rm -rf /opt/eff.org/
    
  3. Install cryptography module:

    sudo python -m pip install cryptography
    
  4. Run certbot-auto --debug

    sudo ./certbot-auto --debug
    
Doorman answered 29/7, 2020 at 13:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.