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

Pinned environment.yaml should not include channel defaults #814

Open
nkaretnikov opened this issue Apr 26, 2024 · 3 comments
Open

Pinned environment.yaml should not include channel defaults #814

nkaretnikov opened this issue Apr 26, 2024 · 3 comments

Comments

@nkaretnikov
Copy link
Contributor

nkaretnikov commented Apr 26, 2024

Context

The generated yaml file includes defaults even when the spec doesn't:

Repro
channels:
- conda-forge
dependencies:
- python ==3.9
- pip:
  - flask
description: ''
name: test
prefix: null
variables: null
channels:
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- ca-certificates=2024.2.2=hbcca054_0
- ld_impl_linux-64=2.40=h55db66e_0
- libffi=3.3=h58526e2_2
- libgcc-ng=13.2.0=hc881cc4_6
- libgomp=13.2.0=hc881cc4_6
- libsqlite=3.45.3=h2797004_0
- libstdcxx-ng=13.2.0=h95c4c6d_6
- libzlib=1.2.13=hd590300_5
- ncurses=6.4.20240210=h59595ed_0
- openssl=1.1.1w=hd590300_0
- pip=24.0=pyhd8ed1ab_0
- python=3.9.0=hffdb5ce_5_cpython
- readline=8.2=h8228510_1
- setuptools=69.5.1=pyhd8ed1ab_0
- sqlite=3.45.3=h2c6b66d_0
- tk=8.6.13=noxft_h4845f30_101
- tzdata=2024a=h0c530f3_0
- wheel=0.43.0=pyhd8ed1ab_1
- xz=5.2.6=h166bdaf_0
- zlib=1.2.13=hd590300_5
- pip:
  - blinker==1.7.0
  - click==8.1.7
  - flask==3.0.3
  - importlib-metadata==7.1.0
  - itsdangerous==2.2.0
  - jinja2==3.1.3
  - markupsafe==2.1.5
  - werkzeug==3.0.2
  - zipp==3.18.1
name: /home/test/.local/share/conda-store/state/default/c289b5a3-1714091897-1-test
prefix: /home/test/.local/share/conda-store/state/default/c289b5a3-1714091897-1-test

This is because conda/mamba env export includes this channel by default. There's an option --override-channels, which should help, I think, but it requires passing at least one -c / --channel flag, which would require extracting channels from the specification.

See action_generate_conda_export and api_get_build_yaml.

Value and/or benefit

Export matches the spec.

Anything else?

No response

@nkaretnikov nkaretnikov added needs: triaging 🚦 Someone needs to have a look at this issue and triage type: enhancement 💅🏼 area: configuration area: user experience 👩🏻‍💻 Items impacting the end-user experience and removed needs: triaging 🚦 Someone needs to have a look at this issue and triage labels Apr 26, 2024
@jonzeper
Copy link
Contributor

jonzeper commented May 2, 2024

We just realized that we've been unintentionally installing some packages from Anaconda's pkgs/main for some time, I guess due to this.

I wasn't able to reproduce the issue using mamba on its own. If I create an environment and export it with mamba env export, it does not add defaults. It seems to only happen when conda-store builds the environment. Not sure why - I tried to troubleshoot a bit but didn't get anywhere. Ended up setting the env var CONDA_CHANNELS=conda-forge as a quick fix on our deployment to restrict available channels.

Anyway, just wanted to throw an upvote for fixing this, and maybe should be considered a bug?
nbconvert=6.5.4 is a good test case -- it exists on pkgs/main but not conda-forge

@trallard
Copy link
Collaborator

@jaimergp do you have any insights on the cleanest way to resolve this?

@jaimergp
Copy link
Member

The cleanest would be "waiting" til deprecations introduced in conda/conda#14227 are effective by March. It seems that users expect the channels list in their environment.yml file to be the only source of channel information (reasonably so!), so we just need to make sure the input and output YAMLs match this part.

I'd say conda/conda#12356 is the cause behind, but we need to figure it out. The canonical workaround is to run conda config --remove channels defaults if defaults is not in the env.yml.

@peytondmurray peytondmurray self-assigned this Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New 🚦
Development

No branches or pull requests

5 participants