Skip to content

conda config --append injects the default value too (e.g. --append channels conda-forge results in channels: [conda-forge, defaults] #12356

@jaimergp

Description

@jaimergp

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

This might be already reported but searching for conda config default append didn't give me any good results, so sorry in advance!

The issue is that in a fresh configuration file, a user might expect that conda config --append channels conda-forge only implies having a .condarc file like:

channels:
  - conda-forge

But in reality is

channels:
  - defaults
  - conda-forge

Note how defaults has higher priority! We appended. Instead, the user is expected to know that they want to prepend instead. A bit unrealistic!

I get that the default value was always defaults, and now we are adding one more. However, conda config --set channels conda-forge is not supported because, confusingly, --set is only for "primitives" (aka scalars, aka anything that is not a list or dict), but channels expects a list. There's no obvious way to set the default channels to conda-forge (or anything else) in a single command. For an example, look at the required acrobatics to do so in the conda-forge based CI.

Things I've tried

Assuming I am on a fresh Miniconda install and I want to configure it to use for conda-forge, I need this:

$ conda config --append channels conda-forge
$ conda config --remove channels defaults  # why do I need this!

Instead I wish we could do something like this:

$ conda config --set channels conda-forge
# or if we get strict: conda config --set channels '[conda-forge]'

But having the default value injected can be surprising and lead to errors like:

Conda Info

conda info

     active environment : base
    active env location : /Users/jrodriguez/.local/anaconda
            shell level : 1
       user config file : /Users/jrodriguez/.condarc
 populated config files : /Users/jrodriguez/.local/anaconda/.condarc
                          /Users/jrodriguez/.condarc
          conda version : 22.11.1
    conda-build version : 3.23.3
         python version : 3.9.15.final.0
       virtual packages : __archspec=1=arm64
                          __osx=11.2.3=0
                          __unix=0=0
       base environment : /Users/jrodriguez/.local/anaconda  (writable)
      conda av data dir : /Users/jrodriguez/.local/anaconda/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /Users/jrodriguez/.local/anaconda/pkgs
                          /Users/jrodriguez/.conda/pkgs
       envs directories : /Users/jrodriguez/.local/anaconda/envs
                          /Users/jrodriguez/.conda/envs
               platform : osx-arm64
             user-agent : conda/22.11.1 requests/2.28.1 CPython/3.9.15 Darwin/20.3.0 OSX/11.2.3 solver/libmamba conda-libmamba-solver/22.8.1 libmambapy/1.1.0
                UID:GID : 501:20
             netrc file : None
           offline mode : False

Conda Config

N/A

Conda list

N/A

Additional Context

No response

Metadata

Metadata

Assignees

Labels

backlogissue has been triaged but has not been earmarked for any upcoming releaselocked[bot] locked due to inactivityplugins::configpertains to conda-configsource::contributorcreated by a frequent contributorsource::partnercreated by or for an Anaconda, Inc. partner companystale[bot] marked as stale due to inactivitystale::recovered[bot] recovered after being marked as staletype::bugdescribes erroneous operation, use severity::* to classify the type

Type

No type

Projects

Status

🏁 Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions