Fixing Python WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)

Python WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages) is an error which occurs a lot when your pip upgrade fails and/or for many other reasons.

In the blog post I attempt to explain why this error takes place and how you can solve it, I will also add other solutions that could solve the error if possible.

Exploring Python WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)

This is an error which occurs a lot when your pip upgrade fails and/or for many other reasons.

Please make sure the error message looks like the error message bellow after double checking. Do not mix between errors.

                                                                       #
WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)
                                                                       #

Bellow, I will present multiple solutions some have worked for me and others have worked for other developers.

The Method that fixed my problem : Clean the site-packages folder

This is an error which occurs a lot when you try to upgrade pip, but it fails. And sometimes this happens for many other reasons.

Foe example, the error can happen after a command like this.

                                                                       #
python -m pip install --upgrade pip --user
                                                                       #

The error is telling us there are files that should be deleted from the site-packages folder.

You should try two options to solve the error.

The first option is to navigate to the site-packages folder. Mine is located in the following location.

                                                                       #
c:\python38\lib\site-packages.
                                                                       #

You should spot the files or folders that start with the ~ . And remove them.

You should also make sure that those files and folders are already mentioned in the error/warning message.

The second option is to stay in the same location – site packages and find folders that have the name ip (some number) and then remove these files.

I hope one of the options above has fixed your error, thank you for reading this article and reaching the end of this blog post.

Summing-up : 

Guys, this has been my best attempt at helping you understand and solve this issue. I hope you found a solution which suits your needs. Consider helping the blog if you can by donating to our Kofi account.

Thank you for reading, keep coding and cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/