如何释放(ana)conda占用的磁盘空间? [英] How to free disk space taken up by (ana)conda?
问题描述
我正在使用conda软件包管理器-很多.到目前为止,我有相当多的环境和大量下载的软件包,这些磁盘占用了我SSD上的大量空间.释放某些空间的明显途径是使用命令
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
来自 https://conda .io/docs/user-guide/tasks/manage-environments.html#exporting-the-environment-file 导出我的旧的非活动项目使用的包,然后删除这些环境.据我了解,这应该释放anaconda2/envs/
中的某些空间,但不能释放anaconda2/pkgs/
中的某些空间.如何摆脱这些套餐?另外,我怀疑可能还有很多软件包,没有任何环境链接到该软件包-会发生这种情况吗?
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?
问题:
- 通常:减少conda占用空间的最佳方法是什么?
- 如何摆脱不再使用任何环境的软件包?如何修剪包裹?我正在从Ubuntu/Debian搜索类似
sudo apt-get autoremove
之类的东西.
- 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:
- 对于我的所有Python项目,我都使用PyCharm,并检查了哪个项目使用哪个环境.对于所有环境,我都使用
conda env export > environment.yml
从 https://conda.io/projects/conda/zh/latest/user-guide/tasks/manage-environments.html#exporting-the-environment-file - 检查我的项目是否仍然可以使用由environment.yml创建的新环境.
- 使用 https://docs.anaconda.com/anaconda/中选项B中的
anaconda-clean
安装/卸载,然后将创建的备份放在保存位置. - 将旧的
anaconda2
目录重命名为anaconda2_backup
. - 安装新的conda环境-就我而言为
miniconda3
. - 从
environment.yml
建立当前项目所需的新环境,并检查其是否有效. - 删除旧的anaconda备份.
- For all my Python projects I use PyCharm and with it I checked which project uses which environment. For all environments I used the
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-file - Check whether my projects still work with new environments created from the environment.yml.
- Use
anaconda-clean
from option B in https://docs.anaconda.com/anaconda/install/uninstall and put the created backup in a save place. - Rename the old
anaconda2
directory toanaconda2_backup
. - Install a new conda environment -
miniconda3
in my case. - Build new environments which are need for current projects from the
environment.yml
s and check whether these work. - Delete the old anaconda backups.
最后,我还使用 https://blog.shadypixel.com/how-to-shrink-an-lvm-volume-safely/,但这仅适用于使用LVM的Linux用户.
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.
这样,我可以释放20到30 GB的空间.
This way I was able to free 20 to 30 GB of space.
这篇关于如何释放(ana)conda占用的磁盘空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!