Python pip breaks and how to recover?

pacman -Qkk python-pip  $(expac -l '\n' %E -S python-pip | sort -u)
$ pacman -Qkk python-pip  $(expac -l '\n' %E -S python-pip | sort -u)

python-pip: 350 total files, 0 altered files
python-appdirs: 17 total files, 0 altered files
python-cachecontrol: 53 total files, 0 altered files
python-colorama: 33 total files, 0 altered files
python-contextlib2: 17 total files, 0 altered files
python-distlib: 46 total files, 0 altered files
python-distro: 30 total files, 0 altered files
python-html5lib: 125 total files, 0 altered files
python-packaging: 35 total files, 0 altered files
python-pep517: 46 total files, 0 altered files
python-progress: 30 total files, 0 altered files
python-pyopenssl: 33 total files, 0 altered files
python-requests: 67 total files, 0 altered files
python-resolvelib: 46 total files, 0 altered files
python-retrying: 14 total files, 0 altered files
python-setuptools: 348 total files, 0 altered files
python-six: 17 total files, 0 altered files
python-toml: 38 total files, 0 altered files

BTW, ~/.local/lib/python3.10/ is empty

$ ls -a ~/.local/lib/python3.10/
.  ..

hm… no idea then…

I hope you learned from your mistake and you don’t use pip to install python packages globally with root permission. Or do you all the time?

I haven’t used pip install as root but used pip uninstall as root.
I want to uninstall the orphan dependencies.
In this case, I uninstalled all the dependencies by autosub, even it needs root.
What’s unexpected is that it’s too hard to recover now.

I think pacman -Syu doesn’t sync perfectly in this case.

Thanks all the same

What about running this?

virtualenv venv
source venv/bin/activate
pip install gitpython

It works

$ pip install gitpython
Collecting gitpython
  Using cached GitPython-3.1.27-py3-none-any.whl (181 kB)
Collecting gitdb<5,>=4.0.1
  Using cached gitdb-4.0.9-py3-none-any.whl (63 kB)
Collecting smmap<6,>=3.0.1
  Using cached smmap-5.0.0-py3-none-any.whl (24 kB)
Installing collected packages: smmap, gitdb, gitpython
Successfully installed gitdb-4.0.9 gitpython-3.1.27 smmap-5.0.0
WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available.
You should consider upgrading via the '/home/abc/test/venv/bin/python -m pip install --upgrade pip' command.

Great :+1:

Just keep in mind: Use ALWAYS a virtual python environment when using pip. Then nothing can break your system, only the virtual python environment would be broken.

Yes, but still can’t find the reason for the problem.

Compare pip at venv and the system?

$ /usr/bin/pip --version
pip 21.0 from /usr/lib/python3.10/site-packages/pip (python 3.10)
$ /home/abc/test/venv/bin/pip --version
pip 21.3.1 from /home/abc/test/venv/lib/python3.10/site-packages/pip (python 3.10)

Maybe it’s easier to wait for the next upgrade

A big upgrade (2GB+ downloaded) from manjaro today doesn’t help.
The problem has been solved by reinstalling manjaro.