Reputation: 4564
Say you installed a package foo
.
Now you’re uninstalling foo
with pip.
What exactly does pip uninstall foo
do?
How does it know to do that?
Does it just delete the foo
folder and its eggs from the Python packages directory? (+ any relevant dependencies)
Or does pip uninstall
sometimes do more than that?
Maybe package authors provide a uninstall.py file maybe.
I understand that if I want to make sure I uninstall a Python package, I can run:
python setup.py install --record files.txt
while installing the package, then remove all the files in files.txt
.
Is that essentially what pip does: track what files were created during setup and remove them? What more to it is there than that?
Upvotes: 2
Views: 1208
Reputation: 1488
Is that essentially what pip does: track what files were created during setup and remove them?
There's one detail here: pip uninstall x
will uninstall the x
package, but if it had to install other dependencies before, those will stay, since it doesn't check if the dependencies used by x
are still used by other packages. They always stay, and that can be a little annoying sometimes.
Upvotes: 2
Reputation: 94676
Is that essentially what pip does: track what files were created during setup and remove them?
Yes.
What more to it is there than that?
If all recorded files were successfully removed pip uninstall
removes the package directory and the corresponding .dist-info
directory (where it stored metadata including the list of files in the package).
And that's all. The end of the story.
Upvotes: 1