How Do You Troubleshoot the pip Message ‘sys.stderr.write(f”ERROR: {exc}”)’?

Problem scenario
You run a pip command (e.g., pip --version), but ou get an error like this:

Traceback (most recent call last):
File "/home/mike/.local/bin/pip", line 7, in
from pip._internal.cli.main import main
File "/home/mike/.local/lib/python3.*/site-packages/pip/_internal/cli/" , line 60
sys.stderr.write(f"ERROR: {exc}")

You no longer want to use Python 2 in on the server. What should you do?


1.a. Run this command: which pip
1.b. Make a mental note of the location; you will need it later in these directions.

  1. Back up the result(s) of the above command.
  2. Delete the file(s) found in step #1.a.
  3. Run these commands:
sudo apt install python-pip
sudo easy_install pip==20.3.4
  1. Run this command: which pip3
  2. Run this command (but substitute "/path/to/pip3/" with the results of step #5, and replace "/path/to/pip" with the location described in step #1.a):
sudo ln -s /path/to/pip3 /path/to/pip

(These directions were adapted from )

Leave a comment

Your email address will not be published. Required fields are marked *