I am using the conda package manager - a lot. By now I have quite a few environments and a lot of downloaded packages taking a lot of space on my SSD. An obvious path to free some of that space is to use the command
conda env export > environment.yml
from https://conda.io/docs/user-guide/tasks/manage-environments.html#exporting-the-environment-file to export which packages my old, inactive projects use(d) and then delete these environments. As far as I understand, this should free some of the space in anaconda2/envs/
, but not in anaconda2/pkgs/
. How do I get rid of these packages? Also, I suspect that there might be quite a few packages still sitting around, to which no environment is linking to - could that happen?
Questions:
- In general: What is the best way to reduce the space taken up by conda?
- How do I get rid of packages that no environment is using anymore? How do I prune my packages? I am searching for something like
sudo apt-get autoremove
from Ubuntu/Debian.
Finally I got around dealing with this issue. In the end it was a couple of days work:
conda env export > environment.yml
to save the settings of the environment from https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#exporting-the-environment-fileanaconda-clean
from option B in https://docs.anaconda.com/anaconda/install/uninstall and put the created backup in a save place.anaconda2
directory toanaconda2_backup
.miniconda3
in my case.environment.yml
s and check whether these work.Finally I also reduced my logical volume with https://blog.shadypixel.com/how-to-shrink-an-lvm-volume-safely/ but this is only for Linux users using LVMs.
This way I was able to free 20 to 30 GB of space.
You can free some space with:
Conda already use symlinks when possible for packages. So, not much to improve here, I guess.
You can list all packages in all envs with a few lines of Python: