[Tutor] Why is there no uninstall option for setup.py?
A.T.Hofkamp
a.t.hofkamp at tue.nl
Mon Jul 13 09:38:56 CEST 2009
Hai,
Welcome to the complexities of package management :)
wcyee wrote:
> Hi, When I am able to find and install a windows package distributed
> as an exe file, I can just go to "Add & Remove Programs" in the
> "Control Panel" and uninstall it.
That's what I call an OS package manager. My Linux one also handles
dependencies (to install A, you first need to install B and C). Don't know
whether your package manager does that too.
In general, you want exactly one package manager at your system imho. If you
have more captains at the ship, they get confused. This is imho the basic
reason why I think extending distutils is not good.
> But if I have to run "python setup.py install", this is not possible.
> I'm trying to understand why uninstall has not been provided. After
> all, setup.py has been available for many years now, right?
setup.py is an installer, not a package manager. Its only job is to install
new packages. It does not take care of dependencies, it does not uninstall.
> Is this because no one has contributed a patch or code? Or is there
> something inherent to python and packages that makes this a hard
> problem (on non-windows platforms)? It seems really odd that there is
> no such thing after such a long time.
There are other variants around, some of them do dependency handling, I
haven't yet seen one that does uninstall too.
I believe that extending the Python installer further brings you into the area
of package management, something your system already provides at OS level. It
is also better positioned there imho.
For the sake of argument, let's assume we have a Python package manager.
Now for example, if you install PyGTK (Python bindings to the GTK library)
from the Python package manager, wouldn't you want it to install GTK too?
The latter however is not a Python package, so how do you do that?
Installing it from the Python package manager means you have two captains at
your ship. If I later tell the OS package manager to install GTK, you'll have
two GTK versions around (assuming it doesn't get confused of the gtk files
that have appeared out of the blue without telling it about the new files).
Alternatively, you can ask the OS package manager to install GTK from the
Python package manager. However, the OS manager is then not aware why it is
installed. When I browse through the installed packages, it says "GTK is not
needed by any installed package", so I may be tempted to remove it.
If I do, a) your PyGTK installation fails, and b) your Python package manager
gets confused, since nobody told him that the GTK library was removed.
If you think this is not bad, think about how to update the GTK library to a
new version, in particular when I also install a package that needs the new
GTK version with the OS package manager.
Good luck.
To get around these problems, you either need (imho) to
a) have 1 OS package manager that manages everything, or
b) have several package manager that understand each other (but that seems
like a complicated version of "a" to me, so it may not be viable).
Albert
More information about the Tutor
mailing list