Completely Remove a Conda Environment
by Rito Ghosh
When you are done with a project, (or choose to abandon it 😉), you might remove your conda environment. Like so:
conda remove --name ENV_NAME --all
Where ENV_NAME
is the name of the environment.
If you are not sure, you can find the environments in your machine by:
conda env list
And, also make sure to deactivate the environment you are going to remove, if you are in it.
So, three steps:
- Deactivate the environment, if you have it activated.
- To copy the name proper, list all the environments, and copy the name.
- Remove the environment using conda.
But, even after you remove an environment, huge bloat remains. Especially if you are working in Deep Learning, where libraries and packages tend to be huge.
You can remove the bloat if you choose it.
For that you have to use the conda clean
command.
After you have removed one or more environments, just run:
conda clean -a
Then just keep saying y 😬.
This is how you can remove the caches, and clean a conda environment fully, and save a ton of valuable space.
My results a while back:
I was able to save ~33 GB of storage space by using this.
References: