question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to uninstall pip-installed package with all its dependencies?

See original GitHub issue

I’ve installed Sphinx via pip, it’s installed 11 more packages, probably it’s dependencies of Sphinx. Now I want to uninstall all this mess. I see --requirement <file> option in the help to uninstall, but I have no clue where I should find this file for Sphinx. I simply executed pip install Sphinx. Can I have something like pip uninstall --with-all-dependencies Sphinx?

I found separate library https://github.com/invl/pip-autoremove which promised to do what I need but unfortunately it did not, maybe it’s not very Windows-compatible. (https://github.com/invl/pip-autoremove/issues/5)

What is recommendation from pip itself here?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
piotr-dobrogostcommented, Oct 3, 2017

@bialix

I would suggest you stop perceiving virtualenv and pip like they would be kind of Python world’s version of OS package manager. This way you can save yourself a whole world of pain. As a hint please notice that pip still does not have proper dependency resolution (issue #988) after all these years it’s being used to install Python packages. This means pip does not have essential feature needed to even start talking about uninstalling something properly. If you want to be able to uninstall pip-installed package with all its dependencies you should create a new virtualenv and install a package with all its dependencies there. Then when you want to uninstall anything you remove whole virtualenv. That’s how it works given current state of packaging tools in Python. Before you start crying; it’s both good and bad at the same time as the world of software seems to be moving from how to modify already existing environment to our needs towards how to quickly create the same environment from scratch.

2reactions
pfmoorecommented, Oct 2, 2017

It’s also worth pointing out that there’s various tools appearing or gaining in popularity that build on the low-level base provided by pip/virtualenv/venv to provide a more “complete” approach to environment management. Tools like pipenv, hatch, pip-tools and pew may be worth investigating - they may not suit your particular needs, but the model of having higher-level management tools rather than loading the responsibility for handling every possible type of user requirement onto the base tools is becoming more common.

For the case of managing Sphinx, either of pew or pipenv seem like a good fit for what you want. Or if you just want to install Sphinx as a standalone tool, pipsi might be suitable (I’ve not used pipsi with Sphinx, so it might not be appropriate, but it is worth a look).

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Does uninstalling a package with "pip" also remove ...
Although technically this solution does successfully remove all the dependencies, as mentioned in the other answers, it also uninstalls ...
Read more >
Remove a package with its dependencies that are ... - GitHub
pip has all the information to uninstall dependencies. This issue is about uninstalling leaves created by an uninstall . That's useful to many...
Read more >
pip uninstall - pip documentation v22.3.1
Uninstall all the packages listed in the given requirements file. This option can be used multiple times. -y, ...
Read more >
What is the easiest way to remove all packages installed by pip?
You can run the following command to remove all the packages installed by pip it saves your virtual environment:- pip freeze | xargs...
Read more >
Installing, uninstalling, or upgrading Python modules using ...
Uninstalling/removing Python packages using Pip · Open a terminal window. · To uninstall, or remove, a package use the command '$PIP uninstall < ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found