If you've been using Anaconda Python for a while, and been creating multiple environments and adding/removing packages, you may have noticed that it's starting to take up a lot of disk space (sometimes tens of GBs).
Anaconda installation can get big |
One reason is that anaconda environments are completely isolated workspaces from each other with their own copy of Python. So, the more environments you have, the larger the space needed by anaconda. But the other reason is that anaconda keeps a cache of the package files, tarballs etc. of the packages you've installed. This is great when you need to reinstall the same packages. But, over time, the space can add up.
So, how do we clean up this cache and regain some disk space?
We can try going into the 'pkgs' directory and manually clean them up.
Or, we can go the easy way, by using the 'conda clean' command.
You can also run the command in dry-run mode to see what would get cleaned up,
conda clean --all --dry-run
Once you're satisfied with what might be deleted, you can run the clean up,
conda clean --all
This will clean the index cache, lock files, tarballs, unused cache packages, and the source cache.
Cleaning the tarballs |
Cleaning the tarballs #2 |
Cleaning the packages |
Cleaning the packages #2 |
Cleaning the source cache |
Based on your usage, this would clean up from a couple of GBs to maybe 10+GB.
See the command in action,
Build Deeper: The Path to Deep Learning
Learn the bleeding edge of AI in the most practical way: By getting hands-on with Python, TensorFlow, Keras, and OpenCV. Go a little deeper...
Get your copy now!
Nice...
ReplyDeleteThank you !
How does it define "unused"? I would hate to remove something and then need it.
ReplyDelete