close

How to uninstall all unused packages in a conda virtual environment?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to uninstall all unused packages in a conda virtual environment in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to uninstall all unused packages in a conda virtual environment?

  1. How to uninstall all unused packages in a conda virtual environment?

    will sanitize everything. But take note: if you ever want to do any type of --offline operations, don't use --all; be more selective.

  2. uninstall all unused packages in a conda virtual environment

    will sanitize everything. But take note: if you ever want to do any type of --offline operations, don't use --all; be more selective.

Method 1

conda clean --yes --all

will sanitize everything. But take note: if you ever want to do any type of --offline operations, don’t use --all; be more selective.

Method 2

For what it’s worth, I noticed the following…

  • conda clean --all --dry-run gave me a rough total of 2GB
  • conda clean --packages --dry-run gave me a rough total of 6GB

So same discrepancy as observed by OP…

When I next did conda clean --tarballs --dry-run I noticed it also gave me 2GB, strange… Comparing output of first and last commands it seems conda clean --all --dry-run only showed me the tarballs, no mention of the packages

I went ahead, did conda clean --tarballs and then reran the conda clean --all --dry-run… guess what? It now showed the packages (after mentioning there were no tarballs, which is logical as I just cleaned them)

My conclusion… when there are still tarballs in the cache, conda clean --all --dry-run does not provide you the full picture of what will/could be removed

Conclusion

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read