英文:
Is it slower to install one package at a time or all at once using conda?
问题
我刚刚新安装了最新版本的Anaconda,需要从conda-forge
安装12个包。一次性安装还是逐个安装会慢一些,或者应该慢一些吗?(环境解决时间太长,通过试验自己回答这个问题需要好几天。)
我首先安装了Miniconda 3.10,然后创建了两个conda环境,3.9和3.7,其中包含anaconda。
我还运行了以下命令:
conda config --set channel_priority strict
conda config --append channels conda-forge
这导致在.condarc
中将“defaults”列在“conda-forge”之上,因此我不必在前面添加defaults。
英文:
I have just freshly installed the latest Anaconda and need to install 12 packages from conda-forge
. Is or should it be slower to install them all at once or one at a time? (The environment solving times are so long that I answering this question myself by trial would take days.)
I first installed Miniconda 3.10 and then created two conda environments 3.9 & 3.7 containing anaconda.
I also did:
conda config --set channel_priority strict
conda config --append channels conda-forge
This resulted in "defaults" being listed above "conda-forge" in .condarc
, so I did not have to prepend defaults.
答案1
得分: 0
以下是翻译好的部分:
"Declare all requirements at creation"(在创建时声明所有要求):是的,一次安装一个包通常较慢,因为求解器需要每次解决环境问题。
"For fastest environment setup, declare all requirements at creation time and use mamba
(a faster frontend for working with Conda environments). Also, using a YAML to define the environment can help with this."(为了获得最快的环境设置,请在创建时声明所有要求,并使用 mamba
(一个更快的用于处理 Conda 环境的前端)。此外,使用 YAML 定义环境也可以有所帮助。)
"Example"(示例):
mamba create -n py39 python=3.9 numpy scipy scikit-learn
或者使用 YAML:
py39.yaml
name: py39
channels:
- conda-forge
dependencies:
- python=3.9
- numpy
- scipy
- scikit-learn
mamba env create -f py39.yaml
"Note on distributions"(关于发行版的说明):如果计划优先考虑 Conda Forge(可能不适用于 OP),那么请注意 Anaconda 的 base 不是一个好选择。Anaconda 与该配置实际上不兼容。Miniconda 更兼容,但优先考虑 conda-forge
会将其有效转换为 Miniforge 变种。
对于那些希望获得最先进性能的人,我推荐使用 Mambaforge base 发行版。它预配置为优先使用 conda-forge
渠道,并包括 mamba
前端。
英文:
Declare all requirements at creation
Yes, it is absolutely slower to install packages one at a time mostly because the solver has to solve the environment each time.
For fastest environment setup, declare all requirements at creation time and use mamba
(a faster frontend for working with Conda environments). Also, using a YAML to define the environment can help with this.
Example
mamba create -n py39 python=3.9 numpy scipy scikit-learn
or with YAML
py39.yaml
name: py39
channels:
- conda-forge
dependencies:
- python=3.9
- numpy
- scipy
- scikit-learn
mamba env create -f py39.yaml
Note on distributions
If one plans to prioritize Conda Forge (may not apply to OP), then be aware that an Anaconda base is a poor choice. Anaconda is effectively incompatible with that configuration. Miniconda is more compatible, but prioritizing conda-forge
effectively converts it to a Miniforge variant.
For those wanting state-of-the-art performance, I recommend the Mambaforge base distribution. It is preconfigured to prioritize conda-forge
channel and includes the mamba
front-end.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论