Asked By – Serjik
There is a
--user option for pip which can install a Python package per user:
pip install --user [python-package-name]
I used this option to install a package on a server for which I do not have root access. What I need now is to uninstall the installed package on the current user. I tried to execute this command:
pip uninstall --user [python-package-name]
But I got:
no such option: --user
How can I uninstall a package that I installed with
pip install --user, other than manually finding and deleting the package?
I’ve found this article
which describes that uninstalling packages from user directory does not supported. According to the article if it was implemented correctly then with
pip uninstall [package-name]
the package that was installed will be also searched in user directories. But a problem still remains for me. What if the same package was installed both system-wide and per-user?
What if someone needs to target a specific user directory?
Now we will see solution for issue: How to uninstall a package installed with pip install –user
Having tested this using Python 3.5 and pip 7.1.2 on Linux, the situation appears to be this:
pip install --user somepackageinstalls to
$HOME/.local, and uninstalling it does work using
pip uninstall somepackage.
This is true whether or not
somepackageis also installed system-wide at the same time.
If the package is installed at both places, only the local one will be uninstalled. To uninstall the package system-wide using
pip, first uninstall it locally, then run the same uninstall command again, with
In addition to the predefined user install directory,
pip install --target somedir somepackagewill install the package into
somedir. There is no way to uninstall a package from such a place using
pip. (But there is a somewhat old unmerged pull request on Github that implements
pip uninstall --target.)
Since the only places
pipwill ever uninstall from are system-wide and predefined user-local, you need to run
pip uninstallas the respective user to uninstall from a given user’s local install directory.