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

Erwin Mayer picture Erwin Mayer · Mar 30, 2016 · Viewed 35k times · Source

I have a conda virtual environment with several unused packages installed inside it (either using pip install or conda install).

What is the easiest way to clean it up so that only packages that are actually used by my code remain, and the others are uninstalled?

Answer

kalefranz picture kalefranz · Jun 18, 2016
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.