.. _uninstalling: Uninstalling distributions -------------------------- .. index:: single: Distributions; uninstalling Assume we've installed Flask as shown in the section :ref:`upgrade-existing`. To uninstall distributions, you can invoke the ``uninstall`` command (which has an alias, ``remove``) as in the following example:: $ distil -e e2 remove werkzeug Removal cannot proceed: other software needs what you are trying to remove: Flask (0.9) As you can see, ``distil`` correctly stated that Werkzeug can't be removed, as it would leave Flask in a non-working state. The same thing happens with the other Flask dependency, Jinja2:: $ distil -e e2 remove jinja2 Removal cannot proceed: other software needs what you are trying to remove: Flask (0.9) However, if we try to uninstall Flask, ``distil`` doesn't complain, but helpfully offers to remove Werkzeug and Jinja2 as they will no longer be required once Flask is gone:: $ distil -e e2 remove flask The following distributions will not be needed any more: Jinja2 (2.6) Werkzeug (0.8.3) Remove them too? (y/n) If we confirm that we want to do this, a final prompt showing what would be removed is displayed:: The following directories will be removed: e2/lib/python2.7/site-packages/flask e2/lib/python2.7/site-packages/Flask-0.9.dist-info e2/lib/python2.7/site-packages/jinja2 e2/lib/python2.7/site-packages/Jinja2-2.6.dist-info e2/lib/python2.7/site-packages/werkzeug e2/lib/python2.7/site-packages/Werkzeug-0.8.3.dist-info Proceed? (y/n) If we say yes to this, the indicated items will be removed. Uninstalling distributions installed with ``pip`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. index:: single: pip; uninstalling distributions installed with In addition to removing distributions installed by itself, ``distil`` can also uninstall distributions installed by ``pip``. Let's reset the environment and install Flask into it using ``pip``:: $ reuse e2 $ e2/bin/pip install flask Downloading/unpacking flask Downloading Flask-0.9.tar.gz (481kB): 481kB downloaded ... (lines omitted for brevity) Successfully installed flask Werkzeug Jinja2 Cleaning up... You can remove these individual distributions with ``distil``, but because ``pip`` installation does not store information about which distributions were installed by user request and which were installed as dependencies, you don't get as good a user experience:: $ distil -e e2 remove werkzeug The following directories will be removed: e2/lib/python2.7/site-packages/werkzeug e2/lib/python2.7/site-packages/Werkzeug-0.8.3-py2.7.egg-info Proceed? (y/n) y Removal completed. $ distil -e e2 remove flask The following directories will be removed: e2/lib/python2.7/site-packages/flask e2/lib/python2.7/site-packages/Flask-0.9-py2.7.egg-info Proceed? (y/n) y Removal completed. $ distil -e e2 remove jinja2 The following directories will be removed: e2/lib/python2.7/site-packages/jinja2 e2/lib/python2.7/site-packages/Jinja2-2.6-py2.7.egg-info Proceed? (y/n) y Removal completed.