How to solve urllib3.contrib issue when using certbot

When I was deploying my blog in my new server, I occur an error when using certbot.

1
ImportError: cannot import name 'appengine' from 'urllib3.contrib' (/usr/local/lib/python3.10/dist-packages/urllib3/contrib/__init__.py)

How to solve

This is because urllib3 was installed by both apt and pip. Just remove the pip version:

1
pip3 uninstall urllib3

Reference

  1. https://stackoverflow.com/questions/76554745/certbot-cannot-import-name-appengine-from-urllib3-contrib