How can I 'clean up' a virtualenv?

If I want to keep my venv as clean as possible how can I clean up the stuff I don't need? Let me lay out an example...

Say I try a bunch of new modules...

pip install foo
pip install bar
pip install foobar
pip install foobarfoo

and these modules have some requirements of their own, etc. later I decide on which one I want to use, but then I have a huge list of stuff in my requirement.txt and I can't remember what I need and what I don't, what depends on what, etc.

How can I keep it clean and lean?

This answer may be just what you need.

You can install and use the pip-autoremove utility to remove a package plus unused dependencies.

# install pip-autoremove 
pip install pip-autoremove
# remove "somepackage" plus its dependencies: 
pip-autoremove somepackage -y

Advice for the public, Q. Where can I buy hand sanitizer? If I can't find it in the store, can I make my own ? Lyrics to 'How Can I' by Zan Fiskum. In Wonder of the God who saves / Each morning I sing the same / Of lavished grace on grace each day / You took the place of me / Discovered using Shazam, the music discovery app.

Coronavirus Disease (COVID-19), To help lessen the spread of the new coronavirus and COVID-19, the disease it causes, here are important steps to help protect your and your family's health. This can help prevent skin irritation from where the mask rubs your face. If you have oily skin, you may want to avoid wearing a liquid foundation as that can clog your pores and cause your skin

To uninstall every package (including dependencies) you can freeze the requirements and then pass them to pip uninstall:

pip freeze > to-uninstall.txt
pip uninstall -r to-uninstall.txt

COVID-19 Frequently Asked Questions, We're here Monday through Friday, 8:00 a.m. to 9:00 p.m. ET. What should I do if I need to change my direct deposit or contact information? The following quick treatments can help induce a bowel movement in a few hours. 1. Take a fiber supplement. Fiber supplements are readily available and effective at inducing bowel movements if a

pip uninstall followed by one or more package names will remove the packages from the virtual environment.

Python Documentation

How Can I Protect Myself (and Others) from the New Coronavirus , How do I find scholarships? You can learn about scholarships in several ways, including contacting the financial aid office at the school you plan to attend and� This can lead to a build-up of both glucose and triglycerides in the blood. Fortunately, setting a regular eating pattern can help prevent insulin resistance and high triglycerides.

View Your VA Payment History, Coronavirus disease 2019 (COVID-19) is spreading in countries around the world. Find out how to protect yourself and those close to you. How can I find out if my PC supports virtualization. Download and run the free utilities provided by your PC's CPU manufacturer. If your processor is made by Intel, the Intel Processor Identification Utility, see a), detects whether your PC supports virtualization (VT-x technology), See b) for AMD processors (AMD-V technology) a) Intel users.

Finding and Applying for Scholarships, You're more likely to get pregnant if you and your partner are both in good health. Making some changes to your lifestyle may improve your chances of getting� The home affordability calculator from realtor.com® helps you estimate how much house you can afford. Quickly find the maximum home price within your price range.

Coronavirus: What is it and how can I protect myself?, Save your screenshot as an image file. Click File, click Save, enter a file name, click a location on the left side of the page, and click Save.. You can change the screenshot's file type by clicking the "Save as type" drop-down box at the bottom of the window and then clicking a different format (e.g., JPEG) in the drop-down menu.

Comments
  • "later I decide on which one I want to use" - then create a new virtualenv and install just what you want
  • the whole point is I am not sure of what I need based on dependencies. Of course I could delete the whole thing, let my processes fail and install as I go, but I am looking for an easier way
  • Don't forget to remove pip-autoremove when done! :->
  • Why would I remove pip autoremove when I am done instead of just leaving it there for future use?
  • I wonder if pip uninstall wouldn't do... When I'm removing with pip-autoremove, there are some dependencies which pip-autoremove cannot deal with (it seems that the order of deleting is important) while pip uninstall works fine.
  • @fanny pip uninstall doesn't remove any dependencies at all.