Can packages be shared across Anaconda environments?

只愿长相守 提交于 2019-12-05 13:28:55

问题


My ~/anaconda directory is taking up too much disk space (10GB), although I have only five environments and have run conda clean. I discovered that when I try to create a new conda environment, Anaconda displays a very long list of packages to be downloaded, which seems to include a full scientific Python stack (Python interpreter, numpy, scipy, etc.). It seems that Anaconda is installing everything independently for each environment. Is this true?

The following list contains some purely speculative ways which could potentially solve the space problem:

  • Can I create a "sub-environment" which "inherits" the packages of a "parent environment"?
  • Can Anaconda be made to share (e.g. via symbolic links on the file system) the same packages used in different environments?
  • Does the default environment have any special status in terms of package managing? I use Anaconda 2, but most of my environments use Python 3. Can I save space by switching to Anaconda 3? (This is regarding the default environment as the "parent environment" of all other environments.)
  • I normally use pip to install packages, as conda install often fails. Does conda install do some smart job to reuse packages already installed somewhere else?

(Debugging information) The sizes of my four environment directories under ~/anaconda/envs are between 1.2GB and 2.6GB. Is this normal?


回答1:


To create environments that "inherit" packages:
You can export/import the names of the packages used with a yaml file.
Or use the --clone flag.
See this answer.



来源:https://stackoverflow.com/questions/50395044/can-packages-be-shared-across-anaconda-environments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!