3

Let's say I am working on a python package. How can I revert a pip install -e .[dev]? That is, something along the lines of python setup.py develop --uninstall but with pip.

Thanks in advance.

Edit

This question has been identified as similar to this one, but it's not. My question is a bit more fundamental.

Community
  • 1
  • 1
gmagno
  • 1,770
  • 1
  • 19
  • 40
  • 2
    `pip uninstall ` – thebjorn Jan 20 '19 at 20:21
  • 2
    @phd No, that is a different issue, likely due to [bug](https://github.com/pypa/pip/issues/4438) in earlier version of pip. Manual removal of files should *not* be required in the usual case. – wim Jan 20 '19 at 20:37
  • Does this answer your question? [How to uninstall editable packages with pip (installed with -e)](https://stackoverflow.com/questions/17346619/how-to-uninstall-editable-packages-with-pip-installed-with-e) – Charlie Parker May 02 '20 at 16:24
  • 1
    @CharlieParker No, that is a different issue, and this OP has already edited to clarify that! Linked question is about pip failing to remove the files associated with an editable install, this question is about pip failing to uninstall the dependencies. The linked question was associated with a bug in pip. See the comment already above yours. – wim May 02 '20 at 16:40
  • @wim thanks from the clarification, seems the title needs an serious edit then. – Charlie Parker May 02 '20 at 17:33

1 Answers1

7

Unfortunately, there is no pip command to uninstall a package and also uninstall dangling dependencies. You have to uninstall one-by-one by checking in pip freeze output.

To uninstall an editable install, you'll need to know the name of the package (check in the setup.py or pyproject.toml file) and then you can remove the usual way:

pip uninstall somepackage
wim
  • 338,267
  • 99
  • 616
  • 750
  • 2
    I see. In fact, and although I did not mention I was thinking about the process of uninstalling dependencies as well. I am glad you mentioned it. Also `python setup.py develop --uninstall` doesn't remove any dependencies either. Thanks. – gmagno Jan 20 '19 at 20:36
  • How is your answer different from the ones here? https://stackoverflow.com/questions/17346619/how-to-uninstall-editable-packages-with-pip-installed-with-e – Charlie Parker May 02 '20 at 16:25
  • 1
    Unrelated. That post is about removing the files of an editable install itself. This question is about dangling dependencies. – wim May 02 '20 at 16:41