When I run conda update --all
, packages from anaconda channel are updated by default. I will prefer to have conda-forge channel by default because the packages are more up to date.
How do I do this?
To use conda-forge
channel by default, conda-forge
should have a higher priority than defaults
channel.
Check the ~/.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
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 documentation explains how conda collect the packages from different channels.
Additional
You should consider setting channel_priority
as strict
, currently flexible
is the default. Based on the conda documentation, strict
will be the default in the next major version bump, conda 5.0.
conda config --set channel_priority strict
To learn what channel_priority does, run 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 config --env --add channels conda-forge
conda config --env --set channel_priority strict