Certbot Python error on Ubuntu 16.04: ImportError: No module named ordered_dict

Grr I'm not actually sure how to repair your system.

You need to downgrade Python 2's pip back to a version (pip==20.3) that supports Python 2 , because the one you have installed in /usr/local/lib/python2.7/dist-packages is too new.

However, you can't easily downgrade it when pip itself is broken.

The only thing that comes to mind is to remove the pip directories from that /usr/local/lib/python2.7/dist-packages/, which will basically remove the externally-installed pip. But this is just off-the-top-of-my-head advice, I wouldn't trust it.

There's also some other advice here: pip install on Python 2 fails with SyntaxError: sys.stderr.write(f"ERROR: {exc}") · Issue #9500 · pypa/pip · GitHub

3 Likes