I have installed a python package with python setup.py install.
How do I uninstall it?
Join Stack Overflow to learn, share knowledge, and build your career.
|
You need to remove all files manually, and also undo any other stuff that installation did manually. If you don't know the list of all files, you can reinstall it with the To record a list of installed files, you can use:
Once you want to uninstall you can use xargs to do the removal:
Or if you're running Windows, use Powershell:
|
|||||||||||||||||||||
|
|
For me, the following mostly works: have pip installed, e.g.:
Check, how is your installed package named from pip point of view:
This shall list names of all packages, you have installed (and which were detected by pip).
The name can be sometime long, then use just the name of the package being shown at the and after Then uninstall the package:
If it asks for confirmation about removing the package, then you are lucky guy and it will be removed. pip shall detect all packages, which were installed by pip. It shall also detect most of the packages installed via easy_install or setup.py, but this may in some rare cases fail. Here is real sample from my local test with package named
Edit 2015-05-20All what is written above still applies, anyway, there are small modifications available now. Install pip in python 2.7.9 and python 3.4Recent python versions come with a package $ python -m ensurepip --upgrade On some systems (like Debian Jessie) this is not available (to prevent breaking system python installation). Using
|
|
which packaging tool/version are you using for this to work? (
distutils, distribute, etc...)
– Ciro Santilli 华涌低端人口 六四事件 法轮功
May 4 '13 at 14:21
|
||
|
I use
setuptools. You may check bitbucket.org/vlcinsky/ttr.aws.utils.s3 (which is not perfect). Anyway, I am quite unhappy with use of namespace packages, sometime import are broken without visible reason. But it is another story.
– Jan Vlcinsky
May 14 '13 at 13:25
|
||
|
correcting myself. Even though I import
setuptools, in fact I use distribute. Another lesson: when installing my own package from pypi and planning to develop another one locally sharing the same namespace, do not use $ pip install <the package>, use $ easy_install <the package>, otherwise you run into conflicts when importing your develop package.
– Jan Vlcinsky
May 19 '13 at 20:47
|
||
|
To help others: because I'm not root, I install everything in my home. Here is what I did
easy_install --user --prefix=$HOME pip. Then I added the following in my PATH: ln -s /home/tflutre/.local/bin/pip ~/bin, ln -s /home/tflutre/.local/bin/pip2.7 ~/bin and ln -s /home/tflutre/.local/bin/pip2 ~/bin.
– tflutre
Feb 20 '14 at 8:50
|
||
|
This should be accepted answer, as is much easier and pip usually comes with Python anyway. It is simple to use in command prompt/terminal -
pip uninstall module or python -m pip uninstall module should work. Also should be cross-platform, as is part of Python.
– Edward
Jan 28 '16 at 17:03
|
|
The #1 answer has problems:
Instead, for unix-like:
And for windows:
There are also unsolvable problems with uninstalling |
|||||||||||||||||||||
|
|
First record the files you have installed. You can repeat this command, even if you have previously run
When you want to uninstall you can just:
This works because the rm command takes a whitespace-seperated list of files to delete and your installation record is just such a list. |
|||||
|
|
Now python gives you the choice to install
to uninstall any package that you don't want anymore. Read more here (pip documentation). |
||||
|
|
|
The lazy way: simply uninstall from the Windows installation menu (if you're using Windows), or from the rpm command, provided you first re-install it after creating a distribution package. For example,
("foo" being an example of course). |
|||||||||||||||||||||
|
|
Go to your python package directory and remove your .egg file, e.g.: In python 2.5(ubuntu): /usr/lib/python2.5/site-packages/ In python 2.6(ubuntu): /usr/local/lib/python2.6/dist-packages/ |
|||||||||
|
|
Probably you can do this as an alternative :- 1) Get the python version -
-> The above command gives you the current python Version which is 2.4.3 2) Get the installation directory of python -
-> From above command you can get the installation directory which is - /usr/lib/python2.4/site-packages 3) From here you can remove the packages and python egg files
This worked for me.. And i was able to uninstall package which was troubling me :) |
|||
|
|
|
I think you can open the setup.py, locate the package name, and then ask pip to uninstall it. Assuming the name is available in a 'METADATA' variable:
|
|||
|
|
|
Extending on what Martin said, recording the install output and a little bash scripting does the trick quite nicely. Here's what I do...
And presto. Uninstalled. |
|||||
|
|
It might be better to remove related files by using bash to read commands, like the following:
|
|||
|
|
setup.pyis conventional file name which can use several packaging modules such asdistutilsordistribute. Is there one in particular you are asking about? – Ciro Santilli 华涌低端人口 六四事件 法轮功 May 4 '13 at 14:19pip uninstall <your_package>. See stackoverflow.com/questions/1231688/…. – Joachim Wuttke Sep 12 '14 at 8:33