Last updated: Apr 10, 2024
Reading timeยท3 min
The "WARNING: Ignoring invalid distribution -ip
(c:\python310\lib\site-packages)" message is shown when there are partially
installed or uninstalled packages in your site-packages
directory.
To resolve the issue, open the lib\site-packages
directory from the warning
message and delete all folders with names starting with a tilde ~
symbol.
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages) WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
lib\site-packages
directory where the issue occurred, e.g. c:\python310\lib\site-packages
(might be different for you).Open the path in Explorer and order the folders by name by clicking on the Name column.
The folders whose names start with a tilde ~
symbol are partially
installed/uninstalled packages for which the installation process didn't finish
successfully.
~
symbol and delete them.If you'd rather do this using the terminal, use the commands that correspond to your shell.
The article shows examples of how to do this using PowerShell, Command Prompt and bash.
~
using PowerShellTo open PowerShell in your site-packages
directory:
Shift
and right-click in Explorer.# โ๏ธ Make sure your shell is in your site-packages directory # ๐๏ธ List all folders that start with a tilde ~ symbol ls ~*
ls ~*
produces the expected
results.Run the following command to delete all folders starting with a tilde ~
symbol.
rm -Recurse ~*
~
using CMDIf you use Command Prompt (CMD) on Windows:
~
symbol.# ๐๏ธ Navigate to your `site-packages` folder cd c:\path\to\site-packages # ๐๏ธ List all folders that start with a tilde ~ symbol dir ~*
dir ~*
produces the expected
results.Run the following command to delete all folders starting with a tilde ~
symbol.
# ๐๏ธ Delete all folders starting with tilde ~ symbol for /f %i in ('dir /a:d /s /b ~*') do rd /s /q %i
~
using BashIf you use Bash shell:
~
symbol.# ๐๏ธ List all folders that start with a tilde ~ symbol ls -d ~*
ls -d ~*
produces the
expected results.Run the following command to delete all folders starting with a tilde ~
symbol.
rm -rf ~*
If your error message contains a package name after the word distribution
,
e.g. "WARNING: Ignoring invalid distribution -ip C:\path\to\site-packages", you
have to delete the specified folder from your site-packages
directory - in the
example the -ip
directory.
Make sure to delete all folders starting with the specified prefix, e.g.
-ip48128
and ~ip
.
Similarly, if your error message starts with "WARNING: Ignoring invalid
distribution -jango", then you have to delete the jango
folder from your
site-packages
directory.
If you still get the warning message when installing or upgrading pip packages, upgrade your version of pip by running the following command.
# ๐๏ธ On Linux or macOS python -m ensurepip --upgrade # ๐๏ธ Using python 3 python3 -m ensurepip --upgrade # ๐๏ธ On Windows py -m ensurepip --upgrade
ensurepip
package enables us to bootstrap the pip
installer into an existing Python installation or virtual environment.Alternatively, you can use the official get-pip script to install pip.
Download the script from https://bootstrap.pypa.io/get-pip.py by:
get-pip.py
file is downloaded and run the following command.# ๐๏ธ On Linux or macOS python get-pip.py # ๐๏ธ Using python 3 python3 get-pip.py # ๐๏ธ On Windows py get-pip.py
The get-pip.py
script uses bootstrapping logic to install pip
.
curl
(if you have curl
installed).curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # ๐๏ธ On Linux or macOS python get-pip.py --force-reinstall # ๐๏ธ Using python 3 python3 get-pip.py --force-reinstall # ๐๏ธ On Windows py get-pip.py --force-reinstall
The --force-reinstall option
forces pip
to reinstall the package.