Getting “Error: couldn't get currently installed version for letsencrypt” when trying to renew my certificates

Here's what's going on with the message:

Error: couldn't get currently installed version for ~/.local/share/letsencrypt/bin/letsencrypt:

Previously, if your current Certbot installation was broken, we'd just delete it and try and reinstall it. This was causing trouble for people who were trying to customize their local installation, so we now print a message about there being a problem with your current installation and rather than immediately deleting it. This may be the wrong behavior, but you can work around the that problem by deleting the installation yourself by running:

rm -rf "${XDG_DATA_HOME:-~/.local/share}/letsencrypt"

As for

ImportError: No module named interface

this is unfortunately a long standing, known problem with certbot-auto on Amazon Linux. certbot-auto has never fully supported Amazon Linux, as showcased by the need to include --debug when you install Certbot on that system and the following message when you fail to do so:

WARNING: Amazon Linux support is very experimental at present...
if you would like to work on improving it, please ensure you have backups
and then run this script again with the --debug flag!

You can track the progress of this problem at AMI zope errors related to PYTHON_INSTALL_LAYOUT · Issue #2823 · certbot/certbot · GitHub. We've seen some success with unset PYTHON_INSTALL_LAYOUT as recommended above, but that did not solve the issue for everyone in the thread.

Most of our "experimental" support for different distros have been developed by the open source community and then reviewed by the Certbot team. If someone is interested in tracking down the problem here and developing a reliable solution, we'd love to see a pull request, but I don't think the small number of paid Certbot developers have the resources to investigate and develop a solution for this platform that is currently not officially supported by certbot-auto.

Despite this, I encourage you to try the advice given in this post of deleting your current Certbot installation, running unset PYTHON_INSTALL_LAYOUT, and running certbot-auto --debug again. I hope this helps!

3 Likes

I am still facing this problem. I tried all commands suggested above.

JohnDoe ~/Documents $ sudo rm -rf ~/.local/share/letsencrypt
JohnDoe ~/Documents $ ./certbot-auto --debug
Bootstrapping dependencies for Debian-based OSes...
Atteint http://packages.dotdeb.org wheezy Release.gpg
Atteint http://packages.dotdeb.org wheezy-php56 Release.gpg
Atteint http://packages.dotdeb.org wheezy-php55 Release.gpg
Atteint http://packages.dotdeb.org wheezy Release
Atteint http://packages.dotdeb.org wheezy-php56 Release
Atteint http://packages.dotdeb.org wheezy-php55 Release
Atteint http://packages.dotdeb.org wheezy/all Sources
Atteint http://packages.dotdeb.org wheezy/all amd64 Packages
Atteint http://dl.google.com stable Release.gpg
Atteint http://packages.dotdeb.org wheezy-php56/all Sources
Atteint http://packages.dotdeb.org wheezy-php56/all amd64 Packages
Atteint http://ppa.launchpad.net trusty Release.gpg
Atteint http://ppa.launchpad.net precise Release.gpg
Atteint http://security.debian.org wheezy/updates Release.gpg
Atteint http://ppa.launchpad.net trusty Release
Atteint http://dl.google.com stable Release
Atteint http://security.debian.org wheezy/updates Release
Atteint http://ppa.launchpad.net precise Release
Atteint http://dl.google.com stable/main amd64 Packages
Atteint http://packages.dotdeb.org wheezy-php55/all amd64 Packages
Atteint http://ppa.launchpad.net trusty/main Sources
Atteint http://security.debian.org wheezy/updates/contrib Sources
Atteint http://ppa.launchpad.net trusty/main amd64 Packages
Atteint http://ppa.launchpad.net trusty/main Translation-en
Atteint http://security.debian.org wheezy/updates/non-free Sources
Atteint http://ppa.launchpad.net precise/main Sources
Atteint http://security.debian.org wheezy/updates/contrib amd64 Packages
Atteint http://ppa.launchpad.net precise/main amd64 Packages
Atteint http://ppa.launchpad.net precise/main Translation-en
Ign http://packages.dotdeb.org wheezy/all Translation-fr_FR
Ign http://packages.dotdeb.org wheezy/all Translation-fr
Ign http://packages.dotdeb.org wheezy/all Translation-en
Ign http://packages.dotdeb.org wheezy-php56/all Translation-fr_FR
Ign http://packages.dotdeb.org wheezy-php56/all Translation-fr
Ign http://packages.dotdeb.org wheezy-php56/all Translation-en
Ign http://packages.dotdeb.org wheezy-php55/all Translation-fr_FR
Ign http://packages.dotdeb.org wheezy-php55/all Translation-fr
Ign http://packages.dotdeb.org wheezy-php55/all Translation-en
Atteint http://security.debian.org wheezy/updates/non-free amd64 Packages
Atteint http://security.debian.org wheezy/updates/contrib Translation-en
Atteint http://security.debian.org wheezy/updates/non-free Translation-en
Atteint http://http.debian.net wheezy-backports Release.gpg
Atteint http://http.debian.net wheezy-backports Release
Atteint http://http.debian.net wheezy-backports/main amd64 Packages/DiffIndex
Ign http://dl.google.com stable/main Translation-fr_FR
Ign http://dl.google.com stable/main Translation-fr
Atteint http://http.debian.net wheezy-backports/main Translation-en/DiffIndex
Ign http://dl.google.com stable/main Translation-en
Atteint https://get.docker.io docker Release.gpg
Atteint https://get.docker.io docker Release
Atteint https://get.docker.io docker/main amd64 Packages
Ign https://get.docker.io docker/main Translation-fr_FR
Ign https://get.docker.io docker/main Translation-fr
Ign https://get.docker.io docker/main Translation-en
Lecture des listes de paquets... Fait
W: Aucune clé publique n'est disponible pour la/les clé(s) suivante(s) :
1397BC53640DB551
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
augeas-lenses est déjà la plus récente version disponible.
libaugeas0 est déjà la plus récente version disponible.
openssl est déjà la plus récente version disponible.
python est déjà la plus récente version disponible.
python-dev est déjà la plus récente version disponible.
libffi-dev est déjà la plus récente version disponible.
libssl-dev est déjà la plus récente version disponible.
gcc est déjà la plus récente version disponible.
python-virtualenv est déjà la plus récente version disponible.
ca-certificates est déjà la plus récente version disponible.
0 mis à jour, 0 nouvellement installés, 0 à enlever et 5 non mis à jour.
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Requesting root privileges to run certbot...
  /home/JohnDoe/.local/share/letsencrypt/bin/letsencrypt --debug
Traceback (most recent call last):
  File "/home/JohnDoe/.local/share/letsencrypt/bin/letsencrypt", line 7, in <module>
from certbot.main import main
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/certbot/main.py", line 13, in <module>
from acme import jose
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/__init__.py", line 37, in <module>
from acme.jose.interfaces import JSONDeSerializable
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/interfaces.py", line 9, in <module>
from acme.jose import util
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/util.py", line 5, in <module>
import OpenSSL
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in <module>
from OpenSSL._util import (
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so: undefined symbol: OPENSSL_sk_num

Thanks.

Are you seeing the error “Error: couldn’t get currently installed version” ? from your logs this looks like a completely different issue to the one in this thread.

If you are not seeing that specific error, I’d suggest splitting this into a more appropriate new topic.

yes it’s exactly the error I meet: “Error: couldn’t get currently installed version for /root/.local/share/letsencrypt/bin/letsencrypt:”

root /etc/apache2/sites-available # cd /home/JohnDoe/Documents/ && ./certbot-auto --logs-dir /var/log/letsencrypt/
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/site-packages/certbot/main.py", line 13, in <module>
	from acme import jose
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/__init__.py", line 37, in <module>
	from acme.jose.interfaces import JSONDeSerializable
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/interfaces.py", line 9, in <module>
	from acme.jose import util
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/util.py", line 5, in <module>
	import OpenSSL
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
	from OpenSSL import rand, crypto, SSL
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in <module>
	from OpenSSL._util import (
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
	from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
	from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /root/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so: undefined symbol: OPENSSL_sk_num

OK, Thanks, I didn’t see it in the earlier log.

and you have deleted the letsencrypt folder from any earlier installations, yet still getting the error ? can you manually try removing /root/.local/share/letsencrypt and trying again ?

Same error :confused:

root ~ # rm -rf /root/.local/share/letsencrypt
root ~ # cd /home/JohnDoe/Documents
root /home/JohnDoe/Documents # ./certbot-auto
Bootstrapping dependencies for Debian-based OSes...
Atteint http://packages.dotdeb.org wheezy Release.gpg
Atteint http://packages.dotdeb.org wheezy-php56 Release.gpg
Atteint http://packages.dotdeb.org wheezy-php55 Release.gpg
Atteint http://packages.dotdeb.org wheezy Release
Atteint http://packages.dotdeb.org wheezy-php56 Release
Atteint http://security.debian.org wheezy/updates Release.gpg
Atteint http://dl.google.com stable Release.gpg
Atteint http://ppa.launchpad.net trusty Release.gpg
Atteint http://ppa.launchpad.net precise Release.gpg
Atteint http://packages.dotdeb.org wheezy-php55 Release
Réception de : 1 http://http.debian.net wheezy-backports Release.gpg [1 554 B]
Atteint http://ppa.launchpad.net trusty Release
Atteint http://dl.google.com stable Release
Atteint http://security.debian.org wheezy/updates Release
Atteint http://ppa.launchpad.net precise Release
Réception de : 2 http://http.debian.net wheezy-backports Release [164 kB]
Atteint http://packages.dotdeb.org wheezy/all Sources
Atteint http://packages.dotdeb.org wheezy/all amd64 Packages
Atteint http://packages.dotdeb.org wheezy-php56/all Sources
Atteint http://packages.dotdeb.org wheezy-php56/all amd64 Packages
Atteint http://ppa.launchpad.net trusty/main Sources
Atteint http://dl.google.com stable/main amd64 Packages
Atteint http://security.debian.org wheezy/updates/contrib Sources
Atteint http://ppa.launchpad.net trusty/main amd64 Packages
Atteint http://http.debian.net wheezy-backports/main amd64 Packages/DiffIndex
Atteint http://packages.dotdeb.org wheezy-php55/all amd64 Packages
Atteint http://security.debian.org wheezy/updates/non-free Sources
Atteint http://security.debian.org wheezy/updates/contrib amd64 Packages
Atteint http://ppa.launchpad.net trusty/main Translation-en
Atteint http://ppa.launchpad.net precise/main Sources
Atteint http://ppa.launchpad.net precise/main amd64 Packages
Atteint http://http.debian.net wheezy-backports/main Translation-en/DiffIndex
Atteint http://security.debian.org wheezy/updates/non-free amd64 Packages
Atteint http://ppa.launchpad.net precise/main Translation-en
Atteint http://security.debian.org wheezy/updates/contrib Translation-en
Atteint http://security.debian.org wheezy/updates/non-free Translation-en
Ign http://packages.dotdeb.org wheezy/all Translation-fr_FR
Ign http://packages.dotdeb.org wheezy/all Translation-fr
Ign http://packages.dotdeb.org wheezy/all Translation-en
Ign http://packages.dotdeb.org wheezy-php56/all Translation-fr_FR
Ign http://packages.dotdeb.org wheezy-php56/all Translation-fr
Ign http://packages.dotdeb.org wheezy-php56/all Translation-en
Ign http://packages.dotdeb.org wheezy-php55/all Translation-fr_FR
Ign http://packages.dotdeb.org wheezy-php55/all Translation-fr
Ign http://packages.dotdeb.org wheezy-php55/all Translation-en
Ign http://dl.google.com stable/main Translation-fr_FR
Ign http://dl.google.com stable/main Translation-fr
Ign http://dl.google.com stable/main Translation-en
Atteint https://get.docker.io docker Release.gpg
Atteint https://get.docker.io docker Release
Atteint https://get.docker.io docker/main amd64 Packages
Ign https://get.docker.io docker/main Translation-fr_FR
Ign https://get.docker.io docker/main Translation-fr
Ign https://get.docker.io docker/main Translation-en
166 ko réceptionnés en 23s (7 008 o/s)
Lecture des listes de paquets... Fait
W: Aucune clé publique n'est disponible pour la/les clé(s) suivante(s) :
1397BC53640DB551
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
augeas-lenses est déjà la plus récente version disponible.
libaugeas0 est déjà la plus récente version disponible.
openssl est déjà la plus récente version disponible.
python est déjà la plus récente version disponible.
python-dev est déjà la plus récente version disponible.
libffi-dev est déjà la plus récente version disponible.
libssl-dev est déjà la plus récente version disponible.
gcc est déjà la plus récente version disponible.
python-virtualenv est déjà la plus récente version disponible.
ca-certificates est déjà la plus récente version disponible.
0 mis à jour, 0 nouvellement installés, 0 à enlever et 5 non mis à jour.
Creating virtual environment...
Installing Python packages...
Installation succeeded.
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/site-packages/certbot/main.py", line 13, in <module>
    from acme import jose
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/__init__.py", line 37, in <module>
    from acme.jose.interfaces import JSONDeSerializable
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/interfaces.py", line 9, in <module>
    from acme.jose import util
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/util.py", line 5, in <module>
    import OpenSSL
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in <module>
    from OpenSSL._util import (
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /root/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so: undefined symbol: OPENSSL_sk_num

root ~ # lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.11 (wheezy)
Release: 7.11
Codename: wheezy
root ~ # uname -a
Linux JohnDoe 3.16.0-0.bpo.4-amd64 #1 SMP Debian 3.16.39-1~bpo70+1 (2017-01-12) x86_64 GNU/Linux

root ~ # openssl version
OpenSSL 1.1.0e 16 Feb 2017

Edit: added some missing information about config
Hope this helps

As far as I can see, from this post, and the first post - it does not mention the “couldn’t get installed version” error. Your second post does though,

What’s the difference between these two runs ?

How did you install certbot ? ( /home/JohnDoe/Documents/ seems an unusual location )

Certbot is not installed in Document. Only executables files are in the JonhDoe’s personnal directory.
Yes it’s not conventional but as you can see above, no modifications from downloaded Github files are made.

I tried to delete all files and restart from new install. This is all the results I got :

root ~ # sudo rm -rf ~/.local/share/letsencrypt
root ~ # ls .local/share
root ~ # exit
exit
JohnDoe ~ $ cd Documents/
JohnDoe ~/Documents $ ls
certbot-auto
JohnDoe ~/Documents $ rm certbot-auto
JohnDoe ~/Documents $ rm -rf ~/.local/share/letsencrypt
JohnDoe ~/Documents $ wget https://dl.eff.org/certbot-auto
--2017-03-08 17:21:29--  https://dl.eff.org/certbot-auto
Résolution de dl.eff.org (dl.eff.org)... 173.239.79.196
Connexion vers dl.eff.org (dl.eff.org)|173.239.79.196|:443...connecté.
requête HTTP transmise, en attente de la réponse...200 OK
Longueur: 46789 (46K) [application/octet-stream]
Sauvegarde en : «certbot-auto»

100%[===================================================================================================================================================================================================>] 46 789      --.-K/s   ds 0,1s

2017-03-08 17:21:33 (322 KB/s) - «certbot-auto» sauvegardé [46789/46789]

JohnDoe ~/Documents $ chmod a+x certbot-auto
JohnDoe ~/Documents $ ./certbot-auto
Bootstrapping dependencies for Debian-based OSes...
[sudo] password for JohnDoe:
Atteint http://packages.dotdeb.org wheezy Release.gpg
Atteint http://packages.dotdeb.org wheezy-php56 Release.gpg
Atteint http://packages.dotdeb.org wheezy-php55 Release.gpg
Atteint http://packages.dotdeb.org wheezy Release
Atteint http://packages.dotdeb.org wheezy-php56 Release
Atteint http://packages.dotdeb.org wheezy-php55 Release
Atteint http://packages.dotdeb.org wheezy/all Sources
Atteint http://packages.dotdeb.org wheezy/all amd64 Packages
Atteint http://dl.google.com stable Release.gpg
Atteint http://packages.dotdeb.org wheezy-php56/all Sources
Atteint http://packages.dotdeb.org wheezy-php56/all amd64 Packages
Atteint http://ppa.launchpad.net trusty Release.gpg
Atteint http://ppa.launchpad.net precise Release.gpg
Atteint http://ppa.launchpad.net trusty Release
Atteint http://dl.google.com stable Release
Atteint http://ppa.launchpad.net precise Release
Atteint http://packages.dotdeb.org wheezy-php55/all amd64 Packages
Atteint http://dl.google.com stable/main amd64 Packages
Atteint http://ppa.launchpad.net trusty/main Sources
Atteint http://security.debian.org wheezy/updates Release.gpg
Atteint http://ppa.launchpad.net trusty/main amd64 Packages
Atteint http://ppa.launchpad.net trusty/main Translation-en
Atteint http://ppa.launchpad.net precise/main Sources
Atteint http://security.debian.org wheezy/updates Release
Atteint http://ppa.launchpad.net precise/main amd64 Packages
Ign http://packages.dotdeb.org wheezy/all Translation-fr_FR
Ign http://packages.dotdeb.org wheezy/all Translation-fr
Ign http://packages.dotdeb.org wheezy/all Translation-en
Ign http://packages.dotdeb.org wheezy-php56/all Translation-fr_FR
Ign http://packages.dotdeb.org wheezy-php56/all Translation-fr
Ign http://packages.dotdeb.org wheezy-php56/all Translation-en
Ign http://packages.dotdeb.org wheezy-php55/all Translation-fr_FR
Atteint http://ppa.launchpad.net precise/main Translation-en
Ign http://packages.dotdeb.org wheezy-php55/all Translation-fr
Ign http://packages.dotdeb.org wheezy-php55/all Translation-en
Atteint http://security.debian.org wheezy/updates/contrib Sources
Atteint http://http.debian.net wheezy-backports Release.gpg
Atteint http://security.debian.org wheezy/updates/non-free Sources
Atteint http://security.debian.org wheezy/updates/contrib amd64 Packages
Atteint http://security.debian.org wheezy/updates/non-free amd64 Packages
Atteint http://http.debian.net wheezy-backports Release
Atteint http://security.debian.org wheezy/updates/contrib Translation-en
Atteint http://security.debian.org wheezy/updates/non-free Translation-en
Atteint http://http.debian.net wheezy-backports/main amd64 Packages/DiffIndex
Atteint http://http.debian.net wheezy-backports/main Translation-en/DiffIndex
Ign http://dl.google.com stable/main Translation-fr_FR
Ign http://dl.google.com stable/main Translation-fr
Ign http://dl.google.com stable/main Translation-en
Atteint https://get.docker.io docker Release.gpg
Atteint https://get.docker.io docker Release
Atteint https://get.docker.io docker/main amd64 Packages
Ign https://get.docker.io docker/main Translation-fr_FR
Ign https://get.docker.io docker/main Translation-fr
Ign https://get.docker.io docker/main Translation-en
Lecture des listes de paquets... Fait
W: Aucune clé publique n'est disponible pour la/les clé(s) suivante(s) :
1397BC53640DB551
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
augeas-lenses est déjà la plus récente version disponible.
libaugeas0 est déjà la plus récente version disponible.
openssl est déjà la plus récente version disponible.
python est déjà la plus récente version disponible.
python-dev est déjà la plus récente version disponible.
libffi-dev est déjà la plus récente version disponible.
libssl-dev est déjà la plus récente version disponible.
gcc est déjà la plus récente version disponible.
python-virtualenv est déjà la plus récente version disponible.
ca-certificates est déjà la plus récente version disponible.
0 mis à jour, 0 nouvellement installés, 0 à enlever et 5 non mis à jour.
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Requesting root privileges to run certbot...
  /home/JohnDoe/.local/share/letsencrypt/bin/letsencrypt
Traceback (most recent call last):
  File "/home/JohnDoe/.local/share/letsencrypt/bin/letsencrypt", line 7, in <module>
    from certbot.main import main
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/certbot/main.py", line 13, in <module>
    from acme import jose
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/__init__.py", line 37, in <module>
    from acme.jose.interfaces import JSONDeSerializable
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/interfaces.py", line 9, in <module>
    from acme.jose import util
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/util.py", line 5, in <module>
    import OpenSSL
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in <module>
    from OpenSSL._util import (
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so: undefined symbol: OPENSSL_sk_num
JohnDoe ~/Documents $ ./certbot-auto
Error: couldn't get currently installed version for /home/JohnDoe/.local/share/letsencrypt/bin/letsencrypt:
Traceback (most recent call last):
  File "/home/JohnDoe/.local/share/letsencrypt/bin/letsencrypt", line 7, in <module>
    from certbot.main import main
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/certbot/main.py", line 13, in <module>
    from acme import jose
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/__init__.py", line 37, in <module>
    from acme.jose.interfaces import JSONDeSerializable
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/interfaces.py", line 9, in <module>
    from acme.jose import util
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/util.py", line 5, in <module>
    import OpenSSL
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in <module>
    from OpenSSL._util import (
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /home/JohnDoe/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so: undefined symbol: OPENSSL_sk_num
JohnDoe ~/Documents $

As you can see, the famous error “Error: couldn’t get currently installed version for /home/JohnDoe/.local/share/letsencrypt/bin/letsencrypt:” occurs when I launch ./certbot-auto the 2nd time.

Sorry for long reading and thank again for your help.

While the issue you’re having looks remarkably similar to the others in this thread, at the core it’s a bit different. An ImportError is occurring when trying to start Certbot causing the message “Error: couldn’t get currently installed version for /home/JohnDoe/.local/share/letsencrypt/bin/letsencrypt:” but your ImportError occurs when the crypto library that Certbot uses is trying to load its OpenSSL bindings.

I unfortunately don’t have an direct instructions for you on how to fix the problem, but here’s a link to our crypto dependency maintainer explaining that error. I hope this helps.

Thank for tip. In fact I have already checked this issue but after your post I decided to test philippeowagner’ s trick but without chance.

Here is the result. (Patebin)
Still no solution for me :’(

I have same problem and can`t solve it. Ubuntu 14

root@localhost:/usr/local/sbin# sudo chmod a+x /usr/local/sbin/certbot-auto
root@localhost:/usr/local/sbin# certbot-auto --apache -d domain.com
Bootstrapping dependencies for Debian-based OSes...
.....

Fetched 4,100 kB in 4s (822 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc is already the newest version.
augeas-lenses is already the newest version.
ca-certificates is already the newest version.
libaugeas0 is already the newest version.
libffi-dev is already the newest version.
libssl-dev is already the newest version.
openssl is already the newest version.
The following extra packages will be installed:
libpython-dev libpython-stdlib libpython2.7 libpython2.7-dev
libpython2.7-minimal libpython2.7-stdlib python-minimal python-pkg-resources
python-setuptools python2.7 python2.7-dev python2.7-minimal
Suggested packages:
python-doc python-tk python-distribute python-distribute-doc python2.7-doc
binfmt-support
Recommended packages:
python-pip
The following NEW packages will be installed:
libpython-dev libpython-stdlib libpython2.7 libpython2.7-dev
libpython2.7-minimal libpython2.7-stdlib python python-dev python-minimal
python-pkg-resources python-setuptools python-virtualenv python2.7
python2.7-dev python2.7-minimal
0 upgraded, 15 newly installed, 0 to remove and 2 not upgraded.
Need to get 0 B/28.5 MB of archives.
After this operation, 53.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package libpython2.7-minimal:i386.
(Reading database ... 168645 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.6-8ubuntu0.3_i386.deb ...
Unpacking libpython2.7-minimal:i386 (2.7.6-8ubuntu0.3) ...
Selecting previously unselected package libpython2.7-stdlib:i386.
Preparing to unpack .../libpython2.7-stdlib_2.7.6-8ubuntu0.3_i386.deb ...
Unpacking libpython2.7-stdlib:i386 (2.7.6-8ubuntu0.3) ...
Selecting previously unselected package libpython2.7:i386.
Preparing to unpack .../libpython2.7_2.7.6-8ubuntu0.3_i386.deb ...
Unpacking libpython2.7:i386 (2.7.6-8ubuntu0.3) ...
Selecting previously unselected package libpython2.7-dev:i386.
Preparing to unpack .../libpython2.7-dev_2.7.6-8ubuntu0.3_i386.deb ...
Unpacking libpython2.7-dev:i386 (2.7.6-8ubuntu0.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.6-8ubuntu0.3_i386.deb ...
Unpacking python2.7-minimal (2.7.6-8ubuntu0.3) ...
Selecting previously unselected package libpython-dev:i386.
Preparing to unpack .../libpython-dev_2.7.5-5ubuntu3_i386.deb ...
Unpacking libpython-dev:i386 (2.7.5-5ubuntu3) ...
Selecting previously unselected package libpython-stdlib:i386.
Preparing to unpack .../libpython-stdlib_2.7.5-5ubuntu3_i386.deb ...
Unpacking libpython-stdlib:i386 (2.7.5-5ubuntu3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.6-8ubuntu0.3_i386.deb ...
Unpacking python2.7 (2.7.6-8ubuntu0.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.5-5ubuntu3_i386.deb ...
Unpacking python-minimal (2.7.5-5ubuntu3) ...
Selecting previously unselected package python.
Preparing to unpack .../python_2.7.5-5ubuntu3_i386.deb ...
Unpacking python (2.7.5-5ubuntu3) ...
Selecting previously unselected package python2.7-dev.
Preparing to unpack .../python2.7-dev_2.7.6-8ubuntu0.3_i386.deb ...
Unpacking python2.7-dev (2.7.6-8ubuntu0.3) ...
Selecting previously unselected package python-dev.
Preparing to unpack .../python-dev_2.7.5-5ubuntu3_i386.deb ...
Unpacking python-dev (2.7.5-5ubuntu3) ...
Selecting previously unselected package python-pkg-resources.
Preparing to unpack .../python-pkg-resources_3.3-1ubuntu2_all.deb ...
Unpacking python-pkg-resources (3.3-1ubuntu2) ...
Selecting previously unselected package python-setuptools.
Preparing to unpack .../python-setuptools_3.3-1ubuntu2_all.deb ...
Unpacking python-setuptools (3.3-1ubuntu2) ...
Selecting previously unselected package python-virtualenv.
Preparing to unpack .../python-virtualenv_1.11.4-1ubuntu1_all.deb ...
Unpacking python-virtualenv (1.11.4-1ubuntu1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Setting up libpython2.7-minimal:i386 (2.7.6-8ubuntu0.3) ...
Setting up libpython2.7-stdlib:i386 (2.7.6-8ubuntu0.3) ...
Setting up libpython2.7:i386 (2.7.6-8ubuntu0.3) ...
Setting up libpython2.7-dev:i386 (2.7.6-8ubuntu0.3) ...
Setting up python2.7-minimal (2.7.6-8ubuntu0.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up libpython-dev:i386 (2.7.5-5ubuntu3) ...
Setting up libpython-stdlib:i386 (2.7.5-5ubuntu3) ...
Setting up python2.7 (2.7.6-8ubuntu0.3) ...
Setting up python-minimal (2.7.5-5ubuntu3) ...
Setting up python (2.7.5-5ubuntu3) ...
Setting up python2.7-dev (2.7.6-8ubuntu0.3) ...
Setting up python-dev (2.7.5-5ubuntu3) ...
Setting up python-pkg-resources (3.3-1ubuntu2) ...
Setting up python-setuptools (3.3-1ubuntu2) ...
Setting up python-virtualenv (1.11.4-1ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Traceback (most recent call last):
File "/root/.local/share/letsencrypt/bin/letsencrypt", line 7, in
from certbot.main import main
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/certbot/main.py", line 13, in
from acme import jose
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/init.py", line 37, in
from acme.jose.interfaces import JSONDeSerializable
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/interfaces.py", line 9, in
from acme.jose import util
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/acme/jose/util.py", line 5, in
import OpenSSL
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/init.py", line 8, in
from OpenSSL import rand, crypto, SSL
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in
from OpenSSL._util import (
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in
from cryptography.hazmat.bindings.openssl.binding import Binding
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /root/.local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so: undefined symbol: OPENSSL_sk_num

root@localhost:/usr/local/sbin# uname -a
Linux localhost 3.13.0-49-generic #83-Ubuntu SMP Fri Apr 10 20:14:51 UTC 2015 i686 i686 i686 GNU/Linux
root@localhost:/usr/local/sbin# openssl version
OpenSSL 1.1.0e  16 Feb 2017

@firestop

How did OpenSSL get like that? Ubuntu 14.04 comes with OpenSSL 1.0.1f, but you have 1.1.0e.

OPENSSL_sk_num was added in 1.1.0; i’d guess that the Python cryptography module got compiled against 1.1.0e (headers in /usr/local/include, perhaps?) but is running against 1.0.1f (in /usr/lib).

I don’t have any suggestions for how to fix it, though.

Thanks for explain but you have seen only one last error. Do you think is that involved?

I just solved this problem.
ImportError: .local/share/letsencrypt/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so: undefined symbol: OPENSSL_sk_num
I updated server’s openssl to 1.1.0e manually, I met this error when try to add a new domain.
The reason is the openssl library did not update to 1.1.x, which contain the OPENSSL_sk_num
check the library link:
ldd ~/.local/share/letsencrypt/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so
and get
libssl.so.1.0.2 => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2 (0x00007fc641fab000)
libcrypto.so.1.0.2 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2 (0x00007fc641b62000)

we need the openssl library 1.1 verson, you can get it by compile openssl with

./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)'

Then copy libcrypto.so.1.1 , libssl.so.1.1 to /usr/lib/x86_64-linux-gnu, edit the current link of libcrypto and libssl to the new library files.

Then run this command

cd ~/.local/share/letsencrypt/bin/
./pip uninstall cryptography pyopenssl -y
./pip install --upgrade pip
rm -rf ~/.cache/
./pip install cryptography pyopenssl

check the library link again

 libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f95a9db8000)
libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f95a9935000)

now Certbot will run normally.

Even following @dany-sh suggestion, I still get the error on Amazon Linux. I've tried all suggested solutions, none work. It was working perfectly before the update.

(venv27)[ec2-user]$ ./letsencrypt-auto -v
Error: couldn't get currently installed version for /home/ec2-user/.local/share/letsencrypt/bin/letsencrypt: 
Traceback (most recent call last):
  File "/home/ec2-user/.local/share/letsencrypt/bin/letsencrypt", line 7, in <module>
    from certbot.main import main
  File "/home/ec2-user/.local/share/letsencrypt/local/lib/python2.7/dist-packages/certbot/main.py", line 7, in <module>
    import zope.component
  File "/home/ec2-user/.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

Got it running on Amazon Linux!!!!

I needed some small changes to @dany-sh code, by adding the --user on pip and virtualenv upgrades, avoiding permission errors. Also, after the pip upgrade it was necessary to restart the bash to have the upgraded pip set on the path.

 pip install pip --upgrade --user
 pip install virtualenv --upgrade --user
virtualenv -p /usr/bin/python27 venv27
. venv27/bin/activate
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
unset PYTHON_INSTALL_LAYOUT

I have same issue. My app run on AMAZON AWS Linux.

[root@ip-172-31-46-223 ~]# /opt/letsencrypt/letsencrypt-auto renew
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 7, 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

Server is up to date. I tried to make all the suggestions above but doesnt’t work still same error. Any other suggestion? Please…

I still have problem :frowning:
Can you help me please?

[root@ip-172-31-46-223 ~]# pip install pip --upgrade
Requirement already up-to-date: pip in /usr/lib/python2.7/dist-packages
[root@ip-172-31-46-223 ~]# pip install virtualenv --upgrade
Collecting virtualenv
  Using cached virtualenv-15.1.0-py2.py3-none-any.whl
Installing collected packages: virtualenv
  Found existing installation: virtualenv 12.0.7
    Uninstalling virtualenv-12.0.7:
      Successfully uninstalled virtualenv-12.0.7
Successfully installed virtualenv-15.1.0
[root@ip-172-31-46-223 ~]# virtualenv -p /usr/bin/python27 venv27
Running virtualenv with interpreter /usr/bin/python27
New python executable in /root/venv27/bin/python27
Also creating executable in /root/venv27/bin/python
Installing setuptools, pip, wheel...done.
[root@ip-172-31-46-223 ~]# . venv27/bin/activate
(venv27) [root@ip-172-31-46-223 ~]# git clone https://github.com/letsencrypt/letsencrypt
Cloning into 'letsencrypt'...
remote: Counting objects: 45253, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 45253 (delta 0), reused 0 (delta 0), pack-reused 45245
Receiving objects: 100% (45253/45253), 13.46 MiB | 8.31 MiB/s, done.
Resolving deltas: 100% (32401/32401), done.
Checking connectivity... done.
(venv27) [root@ip-172-31-46-223 ~]# cd letsencrypt
(venv27) [root@ip-172-31-46-223 letsencrypt]# unset PYTHON_INSTALL_LAYOUT
(venv27) [root@ip-172-31-46-223 letsencrypt]# ./letsencrypt-auto -v
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 7, 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
(venv27) [root@ip-172-31-46-223 letsencrypt]# 

What I should do now?

Hi, this is how I solved this issue in “Amazon Linux AMI 2016.09”.

Basically, I reinstalled it from scratch:

  1. cd $HOME/.local/share
  2. rm -fr letsencrypt
  3. unset PYTHON_INSTALL_LAYOUT
  4. ./certbot-auto -d DOMAIN certonly --webroot -w DOCUMENT_ROOT --debug

And now:
/root/.local/share/letsencrypt/bin/letsencrypt --version
certbot 0.13.0

Regards

1 Like

I’ve had the same (or a very similar) issue recently when updating certs on a number of servers on AWS, the solution seems to have been pip install virtualenv --update. pip was already up to date - after updating virtualenv, re-running the renewal worked fine.

One went from version 12 and the other from 15.0, both up to 15.1 (where renewal was successful).

1 Like