pkg_resources.ContextualVersionConflict: (zope.interface 4.7.1

Running Ubuntu 20.04 and a Flask application with uWSGI and nginx.

I'm trying to run certbot (both with no arguments, and with arguments), and I'm getting the following error.

pkg_resources.ContextualVersionConflict: (zope.interface 4.7.1 (/usr/lib/python3/dist-packages), Requirement.parse('zope.interface>=5.3.0a1'), {'zope.component'})

Fixed it by running:

sudo pip3 install zope.interfaces --upgrade

But now I'm getting:

The requested nginx plugin does not appear to be installed.

(I'm trying to run: certbot --nginx)

I could fix the nginx problem by running: sudo apt purge certbot python3-certbot-nginx -y

And then: sudo pip3 install certbot-nginx

But now I'm getting:

There were too many requests of a given type :: Error creating new order :: too many certificates (5) already issued for this exact set of domains in the last 168 hours: : see Rate Limits - Let's Encrypt

Your Flask Application should be running in it's own dedicated virtualenv.

Running it in the global environment is an antipattern, as is upgrading the system's repository using pip.


Running Ubuntu 20.04 with a Flask/uWSGI/nginx app.

I ran: sudo apt install python3-certbot-nginx

And now I try to run: sudo certbot --nginx

But I get:

ImportError: cannot import name 'IO' from 'acme.magic_typing' (/usr/local/lib/python3.8/dist-packages/acme/

Please use one of the previously issued 5 (!!!) perfectly fine certificates instead of re-issuing new ones unnecessarily.


Also, the certbot package on Ubuntu is severely out of date - it uses release 0.40.1 from November 2019. You should migrate to snapd+certbot.

If you are running Certbot via pip for some reason, you MUST run that in it's own dedicated virtualenv too.


How do I do that?

1 Like

You find where they are on the filesystem and you set up the webserver to use them.

(Hint: in /etc/letsencrypt/live)


You can find our official, pip-based instructions that use a virtual environment here.

I do recommend using the Certbot snap though. It will completely and permanently avoid all of the issues that you've been encountering.


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