WARNING Ignoring invalid distribution dash site-packages
I’m using pip 21.2.3 , I keep getting WARNING Ignoring invalid distribution ... site-packages
while installing/upgrading packages, get the same warning on pip list
I’m use Ubuntu 20.04.
(tutorial-env) j@ubuntu2004:~$ pip list
WARNING: Ignoring invalid distribution -cffi (/home/j/tutorial-env/lib/python3.8/site-packages)
Package Version
------------- -------
packaging 21.0
pip 21.2.3
pkg_resources 0.0.0
resolvelib 0.5.5
setuptools 44.0.0
WARNING: Ignoring invalid distribution -cffi (/home/j/tutorial-env/lib/python3.8/site-packages)
WARNING: Ignoring invalid distribution -cffi (/home/j/tutorial-env/lib/python3.8/site-packages)
(tutorial-env) j@ubuntu2004:~$ pip --version
pip 21.2.3 from /home/j/tutorial-env/lib/python3.8/site-packages/pip (python 3.8)
(tutorial-env) j@ubuntu2004:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
(tutorial-env) j@ubuntu2004:~$
Solution:
Go to site-packages
directory , delete folders whose name start with ~
(tilde)
So why this happens , should be because while pip
is uninstalling a package it rename it first , delete it only after everything is confirmed ok. But somehow pip
“crashed” which leaves that tilde folder there.