简体   繁体   English

如何使用 conda-forge 而不是 anaconda 通道安装“conda update --all”?

[英]How to get "conda update --all" to install using conda-forge instead of anaconda channel?

When I run conda update --all , packages from anaconda channel are updated by default.当我运行conda update --all时,默认情况下会更新来自 anaconda 频道的包。 I will prefer to have conda-forge channel by default because the packages are more up to date.我宁愿默认使用 conda-forge 频道,因为这些软件包是最新的。

How do I do this?我该怎么做呢?

To use conda-forge channel by default, conda-forge should have a higher priority than defaults channel.要默认使用conda-forge通道, conda-forge应该具有比defaults通道更高的优先级。

Check the ~/.condarc检查~/.condarc

cat ~/.condarc

It will return something like this它会返回这样的东西

channels:
  - defaults
  - conda-forge
channel_priority: flexible

Change the channel order from ~/.condarc so that conda-forge is the first channel~/.condarc更改频道顺序,使 conda conda-forge forge 成为第一个频道

channels:
 - conda-forge
 - defaults 
channel_priority: flexible

Or run the command line equivalent或者运行等效的命令行

conda config --add channels conda-forge
Warning: 'conda-forge' already in 'channels' list, moving to the top

Next time when you run conda update --all , it will search from the conda-forge channel before defaults channel.下次运行conda update --all时,它将在defaults通道之前从conda-forge通道搜索。

Conda documentation explains how conda collect the packages from different channels. Conda 文档解释了 conda 如何从不同的渠道收集包。

Additional额外的

You should consider setting channel_priority as strict , currently flexible is the default.您应该考虑将channel_priority设置为strict ,当前flexible是默认设置。 Based on the conda documentation, strict will be the default in the next major version bump, conda 5.0.根据 conda 文档, strict将成为下一个主要版本 bump 的默认设置,即 conda 5.0。

conda config --set channel_priority strict

To learn what channel_priority does, run conda config --describe channel_priority要了解 channel_priority 的作用,请运行conda config --describe channel_priority

channel_priority (ChannelPriority)
Accepts values of 'strict', 'flexible', and 'disabled'. The default
value is 'flexible'. With strict channel priority, packages in lower
priority channels are not considered if a package with the same name
appears in a higher priority channel. With flexible channel priority,
the solver may reach into lower priority channels to fulfill
dependencies, rather than raising an unsatisfiable error. With channel
priority disabled, package version takes precedence, and the
configured priority of channels is used only to break ties. In
previous versions of conda, this parameter was configured as either
True or False. True is now an alias to 'flexible'.

channel_priority: flexible

Also, note that this is a global setting.另请注意,这是一个全局设置。 Referring to this post , if this should only be applied to a specific conda environment, activate the env and add --env in your script参考这篇文章,如果这只应用于特定的 conda 环境,请激活 env 并在脚本中添加--env

conda config --env --add channels conda-forge
conda config --env --set channel_priority strict

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 Anaconda 更新/删除 conda-forge 频道? - How update/remove conda-forge channel from Anaconda? conda install --channel conda-forge pymatgen - conda install --channel conda-forge pymatgen Anaconda-是否使用通道conda-forge破坏了整个环境? - Anaconda - is using channel conda-forge screwing up the whole environment? 使用 conda-forge 作为 Anaconda 的默认通道在 Mac Pro M1 上安装软件包 - Using conda-forge as default channel with Anaconda to install packages on Mac Pro M1 如何完全清除和禁用 Anaconda 中的默认通道并切换到 conda-forge? - How do I completely purge and disable the default channel in Anaconda and switch to conda-forge? 当上传者为“ conda-forge”时,更新conda-forge中的软件包 - Update package in conda-forge, when uploader is “conda-forge” conda install -c conda-forge wget - conda install -c conda-forge wget 为什么使用 conda-forge 时 anaconda install 返回不同的结果? - Why did anaconda install return different results when using conda-forge? 使用诗歌从 conda-forge(例如 cartopy)安装预构建包,而不依赖 conda(仅使用通道) - Install prebuilt packages from conda-forge (e.g. cartopy) using poetry without relying on conda (using only the channel) “conda install -c conda-forge python”导致 anaconda 分发停止工作 - "conda install -c conda-forge python" causes anaconda distribution to stop working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM