Skip to content

Instantly share code, notes, and snippets.

@SZanlongo
Last active April 4, 2019 20:35
Show Gist options
  • Save SZanlongo/09b192c01ff6b30e628bce2411c7aa20 to your computer and use it in GitHub Desktop.
Save SZanlongo/09b192c01ff6b30e628bce2411c7aa20 to your computer and use it in GitHub Desktop.
Uninstall setup.py Installation

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 --record option, and take a look at the list this produces.

To record a list of installed files, you can use:

python setup.py install--record files.txt

Once you want to uninstall you can use xargs to do the removal:

xargs rm - rf < files.txt

Or if you're running Windows, use Powershell:

Get - Content files.txt | ForEach - Object { Remove - Item $_ - Recurse - Force }

Then delete also the containing directory, e.g. /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/my_module-0.1.egg/ onmacOS.It has no files, but Python will still import an empty module:

>>> import my_module
>>> my_module.__file__

None

Once deleted, Python shows:

>>> import my_module
Traceback (most recent call last):

File "", line 1, in ModuleNotFoundError: No module named 'my_module'

From: https://stackoverflow.com/a/1550235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment