Skip to content
Home » WARNING: Ignoring invalid distribution site packages

WARNING: Ignoring invalid distribution site packages

To solve WARNING: Ignoring invalid distribution site packages error follow below methods. Every time I use pip to download a package, I get the following message: WARNING: Invalid distribution -ip is being ignored (path to packages)

ERROR LOG

WARNING: Ignoring invalid distribution -django (c:\users\ssc\appdata\roaming\python\python37\site-packages)

While using pip to install or upgrade packages, then we get these warning sometimes.

WARNING: Ignoring invalid distribution -numpy (/home/j/tutorial-env/lib/python3.8/site-packages)

Why WARNING: Ignoring invalid distribution site packages error Occurs ?

This occurs due to the installation of several versions of libraries; at times, conda or pip fail to remove the versions and instead rename it to “~ip”; therefore, we need locate site-packages in our Python installation and look for “~ip” and delete such folders that begin with ~ip. The problem will then be rectified, and we will no longer receive such alerts. Otherwise, it is only a warning due to the presence of such directories in the installation, which we can ignore.

How to solve WARNING: Ignoring invalid distribution site packages ?

Go to your site-packages directory in your working environment and check if there is any folder whose name start with ‘~’ tilde symbol, if yes delete that folder like shown below.

How to solve WARNING: Ignoring invalid distribution site packages ?

Reasons to delete :

When removing a package, pip will now rename it in place to a name that cannot be imported, and only after it has checked that everything will succeed (including installing new versions if an upgrade is being performed) will it destroy those directories. If something goes wrong, it renames them again.

Previously, it would copy the entire contents to a different directory, and possibly another drive, and then copy them back if necessary. As a result, this update provides a significant performance boost, particularly for packages containing a large number of files.

Alternative to Solve WARNING: Ignoring invalid distribution site packages

This occurs due to files names with the ‘~’ prefix in site-packages. To solve WARNING: Ignoring invalid distribution site packages then Please remove those files / folders.

You can list all those files using the below command (modiy the path to the site-packages in the below command )

ls -a /xx/xx/xx/lib/pythonx.x/site-packages | grep "^~"`

Then remove files/folders prefixed by ‘~’ that are listed above.

Hope the above solution works.

Also read :

Error: (this.configurationService.getValue(…) || []).filter is not a function in VS Code
ModuleNotFoundError: No module named ‘flask._compat’