ImportError: cannot import name jose

My domain is: sargue.net

I ran this command:

certbot --renew

It produced this output:

Traceback (most recent call last):
  File "/usr/bin/certbot", line 11, in <module>
    load_entry_point('certbot==0.19.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 561, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 11, in <module>
    from acme import jose
ImportError: cannot import name jose

My web server is (include version): 2.4.25-3+deb9u4

The operating system my web server runs on is (include version): Debian 9.4

My hosting provider, if applicable, is: OVH

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

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): no

So, I have strech-backports configured and I just updated a package related to certbot.

python-acme (0.22.2-1~bpo9+1) stretch-backports

Now I can’t run certbot anymore (see error above). Missing any package?

Try updating to the latest version.

A normal upgrade doesn’t trigger any update.

root@xxx:~# aptitude upgrade
Resolving dependencies...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

A full-upgrade seems to be dependency broken right now.

root@xxx:~# aptitude full-upgrade
The following NEW packages will be installed:
  python3-acme{a} python3-augeas{a} python3-certbot{ab} python3-certbot-apache{a} python3-configargparse{a} python3-future{a}
  python3-josepy{a} python3-mock{a} python3-openssl{a} python3-parsedatetime{a} python3-pbr{a} python3-rfc3339{a} python3-tz{a}
  python3-zope.component{a} python3-zope.event{a} python3-zope.hookable{a} python3-zope.interface{a}
The following packages will be REMOVED:
  python-acme{u} python-augeas{u} python-certbot{u} python-chardet{u} python-configargparse{u} python-configobj{u}
  python-funcsigs{u} python-josepy{u} python-mock{u} python-parsedatetime{u} python-pbr{u} python-requests{u} python-rfc3339{u}
  python-tz{u} python-zope.component{u} python-zope.event{u} python-zope.hookable{u} python-zope.interface{u}
The following packages will be upgraded:
  certbot python-certbot-apache
The following packages are RECOMMENDED but will NOT be installed:
  python-pyicu python3-dnspython
2 packages upgraded, 17 newly installed, 18 to remove and 0 not upgraded.
Need to get 1,077 kB/1,121 kB of archives. After unpacking 940 kB will be used.
The following packages have unmet dependencies:
 python3-certbot : Depends: python3-acme (>= 0.22.0~) but 0.10.2-1 is to be installed
The following actions will resolve these dependencies:

     Remove the following packages:
1)     certbot [0.19.0-1~bpo9+1 (now)]
2)     python-certbot-apache [0.19.0-1~bpo9+1 (now)]

     Keep the following packages at their current version:
3)     python3-certbot [Not Installed]
4)     python3-certbot-apache [Not Installed]



Accept this solution? [Y/n/q/?]

ensure to
apt update
before
apt upgrade

Sure, I did.

root@xxx:~# apt update
Hit:1 http://security.debian.org stretch/updates InRelease
Ign:2 http://deb.debian.org/debian stretch InRelease
Get:3 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:4 http://deb.debian.org/debian stretch-backports InRelease [91.8 kB]
Hit:5 http://deb.debian.org/debian stretch Release
Get:6 http://deb.debian.org/debian stretch-backports/main amd64 Packages.diff/Index [27.8 kB]
Get:7 http://deb.debian.org/debian stretch-backports/main Translation-en.diff/Index [27.8 kB]
Get:8 http://deb.debian.org/debian stretch-backports/non-free amd64 Packages.diff/Index [10.1 kB]
Get:9 http://deb.debian.org/debian stretch-backports/non-free Translation-en.diff/Index [6,640 B]
Get:10 http://deb.debian.org/debian stretch-backports/main amd64 Packages 2018-04-20-1430.21.pdiff [5,399 B]
Get:11 http://deb.debian.org/debian stretch-backports/main Translation-en 2018-04-20-1430.21.pdiff [2,743 B]
Get:10 http://deb.debian.org/debian stretch-backports/main amd64 Packages 2018-04-20-1430.21.pdiff [5,399 B]
Get:12 http://deb.debian.org/debian stretch-backports/non-free amd64 Packages 2018-04-20-1430.21.pdiff [26 B]
Get:11 http://deb.debian.org/debian stretch-backports/main Translation-en 2018-04-20-1430.21.pdiff [2,743 B]
Get:13 http://deb.debian.org/debian stretch-backports/non-free Translation-en 2018-04-20-1430.21.pdiff [26 B]
Get:12 http://deb.debian.org/debian stretch-backports/non-free amd64 Packages 2018-04-20-1430.21.pdiff [26 B]
Get:13 http://deb.debian.org/debian stretch-backports/non-free Translation-en 2018-04-20-1430.21.pdiff [26 B]
Fetched 263 kB in 0s (415 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@xxx:~# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  certbot python-certbot-apache
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
root@xxx:~# apt full-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  certbot python-certbot-apache
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

Hi @sargue,

Try this:

apt -t stretch-backports install python-certbot-apache python-acme certbot

Cheers,
sahsanu

1 Like

It worked! Thanks a lot.

2 Likes

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