如何释放(ana)conda占用的磁盘空间? [英] How to free disk space taken up by (ana)conda?

查看:2178
本文介绍了如何释放(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?

问题:

  1. 通常:减少conda占用空间的最佳方法是什么?
  2. 如何摆脱不再使用任何环境的软件包?如何修剪包裹?我正在从Ubuntu/Debian搜索类似sudo apt-get autoremove之类的东西.
  1. In general: What is the best way to reduce the space taken up by conda?
  2. 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:

  1. 对于我的所有Python项目,我都使用PyCharm,并检查了哪个项目使用哪个环境.对于所有环境,我都使用conda env export > environment.yml https://conda.io/projects/conda/zh/latest/user-guide/tasks/manage-environments.html#exporting-the-environment-file
  2. 检查我的项目是否仍然可以使用由environment.yml创建的新环境.
  3. 使用 https://docs.anaconda.com/anaconda/中选项B中的anaconda-clean安装/卸载,然后将创建的备份放在保存位置.
  4. 将旧的anaconda2目录重命名为anaconda2_backup.
  5. 安装新的conda环境-就我而言为miniconda3.
  6. environment.yml建立当前项目所需的新环境,并检查其是否有效.
  7. 删除旧的anaconda备份.
  1. 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
  2. Check whether my projects still work with new environments created from the environment.yml.
  3. Use anaconda-clean from option B in https://docs.anaconda.com/anaconda/install/uninstall and put the created backup in a save place.
  4. Rename the old anaconda2 directory to anaconda2_backup.
  5. Install a new conda environment - miniconda3 in my case.
  6. Build new environments which are need for current projects from the environment.ymls and check whether these work.
  7. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆