Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I completely purge and disable the default channel in Anaconda and switch to conda-forge?

Is there a way to completely purge and disable the defaults channel in Anaconda and switch to conda-forge? The reason is that Anaconda term of service limits the use of its repository to non-commercial activities. Switching to conda-forge avoids the issue.

like image 503
xuhdev Avatar asked Sep 07 '25 13:09

xuhdev


2 Answers

Typically, it should be sufficient to remove it from the channels configuration option, which corresponds to the user-level configuration file (~/.condarc). This could just be defaults, but check to see if you also need to remove anaconda, main, r, pro, or other subchannels of defaults.

# check what is currently set
conda config --show channels

# remove what you find 
conda config --remove channels defaults

# add conda-forge
conda config --add channels conda-forge

If this is not sufficient, one can use conda config --show-sources (as suggested by @CorneliusRoemer) to list the locations whence Conda is loading configuration settings (.condarc files, environment variables), as well as the content of each source. This should help in tracking down any atypical specifications of unwanted channels.

Alternatively, you may consider installing a Miniforge base (or a variant), which only includes conda-forge channel by default.


nodefaults option

Mentioned in the Conda docs is a nodefaults channel option for overriding channel settings. For example, this is useful for YAML files to prevent users with defaults in the .condarc from using it during environment creation. Example,

YAML Snippet

channels:
  - conda-forge
  - nodefaults

Note that this only works with Conda YAML files. The code is specific to the conda env subcommand and directs the solver to skip loading additional channels from the configuration context. It should also not be exonFor conda create or conda install commands, there is the --override-channels argument with equivalent functionality.

like image 149
merv Avatar answered Sep 10 '25 03:09

merv


Based on your question, I'm going to assume the reason you are doing this is to continue using an old Anaconda installation by just changing the channels to conda-forge etc for future package downloads and updates.

But keep in mind that any environments you had created earlier would still have the binaries from the default (paid) channels. And as per this Anaconda FAQ:

If a package is hosted in Anaconda channels, you can use conda for free, but downloading, installing, using and updating those packages may require a commercial fee license, which means ...

So while changing channels should work for future environments, remember to either stop using older defaults based environments, or migrate them to conda-forge by reinstalling all packages.

I know this answer doesn't directly answer the question, but I only want to highlight that "Switching to conda-forge avoids the issue." might not be enough to avoid TOS violations.

like image 28
Divyansh Gupta Avatar answered Sep 10 '25 03:09

Divyansh Gupta