I've mixed the pypi.org and Fedora repo Python packages — how to wipe all of the former?

My Python installation is close to being entirely borked, I haven’t been able to update my packages in months nor can I essentially install new ones. I’ve understood that there’s no easy way to list only the packages installed from the package index and the pip list command seems to output all, including the packages which ship with Fedora.

Is it recommended to go as far as to reinstall Fedora and start using virtual environments for the Python packages not found in the Fedora repos?

2 Likes

Maybe something like:
pip freeze --user | xargs pip uninstall

Stops for the first application:

Found existing installation: astunparse 1.6.3
Uninstalling astunparse-1.6.3:
  Would remove:
    /home/user/.local/lib/python3.9/site-packages/astunparse-1.6.3.dist-info/*
    /home/user/.local/lib/python3.9/site-packages/astunparse/*
Proceed (y/n)? ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 189, in _main
    status = self.run(options, args)
  File "/usr/lib/python3.9/site-packages/pip/_internal/commands/uninstall.py", line 87, in run
    uninstall_pathset = req.uninstall(
  File "/usr/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 659, in uninstall
    uninstalled_pathset.remove(auto_confirm, verbose)
  File "/usr/lib/python3.9/site-packages/pip/_internal/req/req_uninstall.py", line 394, in remove
    if auto_confirm or self._allowed_to_proceed(verbose):
  File "/usr/lib/python3.9/site-packages/pip/_internal/req/req_uninstall.py", line 437, in _allowed_to_proceed
    return ask('Proceed (y/n)? ', ('y', 'n')) == 'y'
  File "/usr/lib/python3.9/site-packages/pip/_internal/utils/misc.py", line 223, in ask
    response = input(message)
EOFError: EOF when reading a line