Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaults channel in .condarc file when only conda-forge is specified #207

Open
jrbourbeau opened this issue Dec 17, 2021 · 7 comments · May be fixed by #364
Open

defaults channel in .condarc file when only conda-forge is specified #207

jrbourbeau opened this issue Dec 17, 2021 · 7 comments · May be fixed by #364

Comments

@jrbourbeau
Copy link

We're using setup-miniconda over in dask-bigquery and discovered that when using this environment file which specifies only the conda-forge channel, along with this conda-incubator/setup-miniconda GitHub actions setup, which is using mambaforge and strict channel priority, we still end up with a few packages installed from the main channel. This channel mixing is, I think, leading to CI errors for the project.

If I look at the logs from this CI build

2021-12-16T02:46:39.5858090Z [command]/Users/runner/miniconda3/condabin/conda config --show-sources
2021-12-16T02:46:39.7591180Z ==> /Users/runner/miniconda3/.condarc <==
2021-12-16T02:46:39.7592030Z channels:
2021-12-16T02:46:39.7593320Z   - conda-forge
2021-12-16T02:46:39.7593660Z 
2021-12-16T02:46:39.7594130Z ==> /Users/runner/.condarc <==
2021-12-16T02:46:39.7594690Z auto_update_conda: False
2021-12-16T02:46:39.7595240Z auto_activate_base: False
2021-12-16T02:46:39.7595800Z notify_outdated_conda: False
2021-12-16T02:46:39.7596340Z changeps1: False
2021-12-16T02:46:39.7596820Z pkgs_dirs:
2021-12-16T02:46:39.7597760Z   - /Users/runner/conda_pkgs_dir
2021-12-16T02:46:39.7598350Z channel_priority: strict
2021-12-16T02:46:39.7598860Z channels:
2021-12-16T02:46:39.7599710Z   - conda-forge
2021-12-16T02:46:39.7600550Z   - defaults
2021-12-16T02:46:39.7601040Z always_yes: True

it appears conda config --show-sources, which is run during setup-miniconda shows, two separate sources:

  • /Users/runner/miniconda3/.condarc: which only specifies the conda-forge channel
  • /Users/runner/.condarc: which specifies both conda-forge and defaults

So the defaults channel is being added at some point, but it's not clear to me where and how I can disable it from being added. Any help is appreciated

@jakirkham
Copy link
Member

A simple way to remove would be to just do conda config --remove channels defaults

Could also override the condarc with the channels you want

@goanpeca
Copy link
Member

Hi @jrbourbeau

So we should be using /Users/runner/.condarc and not miniconda3/.condarc it seems

We will take a look

@jakirkham
Copy link
Member

Ran into this as well in issue ( conda-forge/clangdev-feedstock#166 ), which led to a bit of a confusing linking error

@javierggt
Copy link

I think I have the same issue, although I did not use an environment file.

I can verify that with this workflow:

name: Setup Miniconda

on:
  repository_dispatch:
    types:
      - setup-miniconda

jobs:
  setup:
    runs-on: "macos-latest"
    name: Setup
    defaults:
      run:
        shell: bash -l {0}
    steps:
    - uses: conda-incubator/setup-miniconda@v2
      with:
        miniconda-version: "py38_4.8.3"
        python-version: "3.8"
        channels: conda-forge
    # - run: conda config --remove channels defaults
    - run: conda config --show channels
    - run: cat /Users/runner/.condarc

the defaults channel is still used, and the contents of /Users/runner/.condarc are:

notify_outdated_conda: false
pkgs_dirs:
  - /Users/runner/conda_pkgs_dir
channels:
  - conda-forge
  - defaults
auto_activate_base: true
auto_update_conda: false
always_yes: true
changeps1: false

Also, using the workaround suggested by @jakirkham works.

@jakirkham
Copy link
Member

jakirkham commented Nov 14, 2022

Something else worth trying might be adding nodefaults to the channels

@victorlin
Copy link

This is interesting behavior of Conda, to always add defaults unless channels is already defined:

echo "" > test.condarc
conda config --add channels conda-forge --file test.condarc
cat test.condarc
# channels:
#   - conda-forge
#   - defaults

echo "channels: []" > test.condarc
conda config --add channels conda-forge --file test.condarc
cat test.condarc
# channels:
#   - conda-forge

@liamhuber
Copy link

Something else worth trying might be adding nodefaults to the channels

This is even done in the source code for example 6 (although that's not what's shown on the readme); unfortunately all this does is add - nodefaults to the channel list:

Screen Shot 2024-08-26 at 14 10 59

Log source for image: https://github.com/conda-incubator/setup-miniconda/actions/runs/10551479166/job/29228977318

Although this doesn't seem like what's intended from the example, it is intelligible from the source:

for (const channel of channels.slice().reverse()) {
core.info(`Adding channel '${channel}'`);
await condaCommand(["config", "--add", "channels", channel], options);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants