By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,495 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

How to delete a Python package

P: n/a
Installing a Python package is easy, most of time just
"Setup.py install" However, setup.py doesn't seem to support
an uninstall command. If I want to delete a package that I
do not use any more, should I just manually delete the
corresponding sub directory under Lib\site-packages?
Jul 12 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Jack,

As a rule, if you use a Linux distribution, you should just install
the package and then remove the package using the package manager.
Distutils uninstallation is not supported. Of course you could manually
delete the directory in site-packages in most, but not all (!) cases,
that should remove all the files of the package.

Nick Vatamaniuc

Jack wrote:
Installing a Python package is easy, most of time just
"Setup.py install" However, setup.py doesn't seem to support
an uninstall command. If I want to delete a package that I
do not use any more, should I just manually delete the
corresponding sub directory under Lib\site-packages?
Jul 12 '06 #2

P: n/a
On 2006-07-12, Nick Vatamaniuc <va******@gmail.comwrote:
>Installing a Python package is easy, most of time just
"Setup.py install" However, setup.py doesn't seem to support
an uninstall command. If I want to delete a package that I
do not use any more, should I just manually delete the
corresponding sub directory under Lib\site-packages?
As a rule, if you use a Linux distribution, you should just install
the package and then remove the package using the package manager.
That's fine except a lot of python packages aren't available in
any of the various Linux distro package formats.
Distutils uninstallation is not supported. Of course you could
manually delete the directory in site-packages in most, but
not all (!) cases, that should remove all the files of the
package.
--
Grant Edwards grante Yow! I hope something GOOD
at came in the mail today so
visi.com I have a REASON to live!!
Jul 12 '06 #3

P: n/a
>As a rule, if you use a Linux distribution, you should just install
the package and then remove the package using the package manager.
GrantThat's fine except a lot of python packages aren't available in
Grantany of the various Linux distro package formats.

And one or two people don't use Linux yet.

Uninstall support would be a good idea...

Skip
Jul 12 '06 #4

P: n/a
Skip,

Uninstall support is hard, you would turn distutils (setup.py) into a
package management system, but wait...! there are already package
managers that do exactly that (rpm, deb, Windows Installer).

If no distro installer package is available for your Python module --
build it yourself and when done share with others, you are probably
already using a lot of stuff created by others, so if you see something
missing, add it, and give back to the community.

Or you could just use the package folder locally in your project to
begin with and never bother with a system-wide install. In general, for
a 'clean' system try not to use multiple installers or incompatible
package managers to put stuff in your system directories -- it will
create a mess over time.

I use Ubuntu, and so far I was able to find all the Python modules I
need as an installable .deb file, that is why I suggested Linux.
Actually as far as I am concerned, having all your modules, IDEs, and
libraries available in a nicely organized repository, available at the
touch of an 'agt-get' command is a pretty good reason to switch.

Nick V.
sk**@pobox.com wrote:
As a rule, if you use a Linux distribution, you should just install
>the package and then remove the package using the package manager.

GrantThat's fine except a lot of python packages aren't available in
Grantany of the various Linux distro package formats.

And one or two people don't use Linux yet.

Uninstall support would be a good idea...

Skip
Jul 12 '06 #5

P: n/a

NickUninstall support is hard, you would turn distutils (setup.py)
Nickinto a package management system, but wait...! there are already
Nickpackage managers that do exactly that (rpm, deb, Windows
NickInstaller).

Note that I don't really care about uninstall support, certainly not enough
to go through the pain of editing distutils. I'd be happy if the installer
wrote a MANIFEST file that tells me what files and directories it did
install. I'm not as worried about dependencies or overlaps between packages
as much as making sure that when I want to get rid of package X I can
actually delete all of its files. I also realize that's not truly package
management in the rpm/deb sense, but that would be good enough for me.

My message was simply pointing out that telling people "use RPM or DEB" is
not really acceptable. Not everyone uses Linux. Or Windows. Or Macs.
Python is a cross-platform language. Through distutils it includes a basic
cross-platform installation facility. It probably ought to also have a
corresponding basic cross-platform uninstall facility.

Skip
Jul 12 '06 #6

P: n/a
I'd second Skip's point. Now that setup.py does install, and it knows what
to
uninstall (because it copied the files in the first place) I think it's a
good idea
to have "setup.py uninstall" support. :)

<sk**@pobox.comwrote in message
news:ma***************************************@pyt hon.org...
>
NickUninstall support is hard, you would turn distutils (setup.py)
Nickinto a package management system, but wait...! there are already
Nickpackage managers that do exactly that (rpm, deb, Windows
NickInstaller).

Note that I don't really care about uninstall support, certainly not
enough
to go through the pain of editing distutils. I'd be happy if the
installer
wrote a MANIFEST file that tells me what files and directories it did
install. I'm not as worried about dependencies or overlaps between
packages
as much as making sure that when I want to get rid of package X I can
actually delete all of its files. I also realize that's not truly package
management in the rpm/deb sense, but that would be good enough for me.

My message was simply pointing out that telling people "use RPM or DEB" is
not really acceptable. Not everyone uses Linux. Or Windows. Or Macs.
Python is a cross-platform language. Through distutils it includes a
basic
cross-platform installation facility. It probably ought to also have a
corresponding basic cross-platform uninstall facility.

Skip

Jul 12 '06 #7

P: n/a
Skip,
I agree. Some kind of a manifest or log file would be great and
probably not that hard to implement.
Nick
sk**@pobox.com wrote:
NickUninstall support is hard, you would turn distutils (setup.py)
Nickinto a package management system, but wait...! there are already
Nickpackage managers that do exactly that (rpm, deb, Windows
NickInstaller).

Note that I don't really care about uninstall support, certainly not enough
to go through the pain of editing distutils. I'd be happy if the installer
wrote a MANIFEST file that tells me what files and directories it did
install. I'm not as worried about dependencies or overlaps between packages
as much as making sure that when I want to get rid of package X I can
actually delete all of its files. I also realize that's not truly package
management in the rpm/deb sense, but that would be good enough for me.

My message was simply pointing out that telling people "use RPM or DEB" is
not really acceptable. Not everyone uses Linux. Or Windows. Or Macs.
Python is a cross-platform language. Through distutils it includes a basic
cross-platform installation facility. It probably ought to also have a
corresponding basic cross-platform uninstall facility.

Skip
Jul 12 '06 #8

P: n/a
Grant Edwards <gr****@visi.comwrote:
On 2006-07-12, Nick Vatamaniuc <va******@gmail.comwrote:
As a rule, if you use a Linux distribution, you should just install
the package and then remove the package using the package manager.

That's fine except a lot of python packages aren't available in
any of the various Linux distro package formats.
distutils has a build rpm option which works, eg

python setup.py bdist_rpm

I usually run debian systems, so I then run alien on the resulting rpm
to turn it into a .deb.

I always install python packages like this - it has worked every time
so far!

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Jul 13 '06 #9

P: n/a

Nick Vatamaniuc wrote:
Skip,
I agree. Some kind of a manifest or log file would be great and
probably not that hard to implement.
Nick
What's wrong with the "record" option of install:
python setup.py install --record installed_files

Then it's pretty easy to do:
rm -rf `cat installed_files`

Hmm, I guess that's easy on *nix.
Maybe setup *should* support uninstall for consistant cross-platform
behavior.

-- George
>
sk**@pobox.com wrote:
NickUninstall support is hard, you would turn distutils (setup.py)
Nickinto a package management system, but wait...! there are already
Nickpackage managers that do exactly that (rpm, deb, Windows
NickInstaller).

Note that I don't really care about uninstall support, certainly not enough
to go through the pain of editing distutils. I'd be happy if the installer
wrote a MANIFEST file that tells me what files and directories it did
install. I'm not as worried about dependencies or overlaps between packages
as much as making sure that when I want to get rid of package X I can
actually delete all of its files. I also realize that's not truly package
management in the rpm/deb sense, but that would be good enough for me.

My message was simply pointing out that telling people "use RPM or DEB" is
not really acceptable. Not everyone uses Linux. Or Windows. Or Macs.
Python is a cross-platform language. Through distutils it includes a basic
cross-platform installation facility. It probably ought to also have a
corresponding basic cross-platform uninstall facility.

Skip
Jul 13 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.