Skip to content

CI Avoid miniconda CondaToSNonInteractiveError #31771

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

Merged
merged 15 commits into from
Jul 16, 2025

Conversation

lesteve
Copy link
Member

@lesteve lesteve commented Jul 16, 2025

This is currently breaking all the PRs with the error (from build log):

+ conda create --name testvenv --file ./build_tools/azure/pylatest_conda_forge_mkl_linux-64_conda.lock

CondaToSNonInteractiveError: Terms of Service have not been accepted for the following channels. Please accept or remove them before proceeding:
    • https://repo.anaconda.com/pkgs/main
    • https://repo.anaconda.com/pkgs/r

To accept a channel's Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda tos accept --override-channels --channel CHANNEL

To remove channels with rejected Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda config --remove channels CHANNEL

Likely a conda change in the Azure image.

Close #31766, close #31767, close #31768, close #31769

Edit: and #31773

Copy link

github-actions bot commented Jul 16, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 1bd5850. Link to the linter CI: here

Comment on lines 30 to 35
- bash: echo "##vso[task.prependpath]$CONDA/Scripts"
displayName: Add conda to PATH
condition: startsWith(variables['DISTRIB'], 'conda')
- bash: build_tools/azure/install_setup_conda.sh
displayName: Install conda if necessary and set it up
condition: startsWith(variables['DISTRIB'], 'conda')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding conda to PATH is also done in install_setup_conda.sh, so we probably don't need it anymore if we're using the script.

Wouldn't it make things simpler to put the accept tos command there ?

python_environment_install_and_activate() {
if [[ "$DISTRIB" == "conda"* ]]; then
create_conda_environment_from_lock_file $VIRTUALENV $LOCK_FILE
activate_environment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels slightly more logical to fix it earlier than in install.sh because this seems related to tweaks that are needed only for the Azure-provided conda.

conda tos only exists for miniconda, sometimes we use miniforge (Azure doesn't have conda installed for macOS-13 and macOS-14).

It seemed too much work to make install_setup_conda.sh work on Windows. So I did a Windows-specific fix in windows.yml.

@icfaust
Copy link
Contributor

icfaust commented Jul 16, 2025

Just as a heads up, Conda released a new ToS yesterday, and is tied to it (we faced similar problems in scikit-learn-intelex yesterday on azp) https://www.anaconda.com/legal/terms/terms-of-service would be worth reviewing generally before accepting (since it has implications on if scikit-learn is a non-profit or not).

@icfaust
Copy link
Contributor

icfaust commented Jul 16, 2025

Our solution was to force everything over to conda-forge uxlfoundation/scikit-learn-intelex#2613

      (echo default_channels: & echo   - https://conda.anaconda.org/conda-forge) >> C:\Users\VssAdministrator\.condarc
      conda config --add channels conda-forge
      conda config --set channel_priority strict

which is a bit 'nuke from orbit', but then again the company I work for is in a legal dispute with anaconda.

@jeremiedbb
Copy link
Member

If I understood correctly, there's no risk using conda, it has the same license as scikit-learn, very permissive (BSD 3-clause). The trouble might come from getting packages from the default channel. I don't know if scikit-learn satisfies the free-of-use conditions, so maybe it's time to stop installing any package from the default channel and install everything from the conda-forge channel.

@jeremiedbb
Copy link
Member

How does it interacts with update_environments_and_lock_files ? Shouldn't we remove the default channel there and regenerate the lock files ?

@lesteve
Copy link
Member Author

lesteve commented Jul 16, 2025

Yes I wanted to make sure the install miniforge bash logic was working first. My last commit makes sure that we are only downloading packages from conda-forge.

Right now it seems that you get the ToS error only if you are using miniconda and not miniforge. Basically if conda (from miniconda) can figure out that you are using the defaults channel it will ask you to accept the ToS. Sometimes it doesn't figure it out like when creating an environment from a lock file where URLs are from the defaults channel ...

@jeremiedbb
Copy link
Member

can figure out that you are using the defaults channel it will ask you to accept the ToS.

If I got it right, using it even if accepting the tos was not asked is implicitly considered accepted, so we better make sure to not use default in any case so that we don't have to worry about it at all :)

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks !

@jeremiedbb
Copy link
Member

I'm merging it with a single approval to unlock PRs and the release.

@jeremiedbb jeremiedbb merged commit f1229ff into scikit-learn:main Jul 16, 2025
37 checks passed
@lesteve lesteve deleted the conda-tos branch July 16, 2025 15:16
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Jul 16, 2025
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Jul 16, 2025
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Jul 16, 2025
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Jul 16, 2025
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Jul 16, 2025
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Jul 16, 2025
@betatim
Copy link
Member

betatim commented Jul 17, 2025

I thought it was on purpose that we have some CI that uses the defaults channel for testing and not have 100% of our CI set up to use conda-forge. The motivation being that we have users who use defaults, so we should (sometimes) check things work. If that is still true, shouldn't we keep some defaults based CI?

I'm Ok with this change for now as it unlocks PRs and the release. With a bit more time we should consider the question of testing with defaults or not.

(Should I make a new issue for this?)

@lesteve
Copy link
Member Author

lesteve commented Jul 17, 2025

Indeed there was some motivation to keep some CI builds defaults work because some of our users may use defaults. Honestly I am not sure this was worth it and the ToS thing may just be the last straw that breaks the camel's back ...

  • defaults and conda-forge have been using the same conda recipes for a while IIRC. I guess there could still be subtle differences, but I am not sure what they would be, suggestions more than welcome!
  • I don't recall a defaults specific issue that was caught by the CI, but of course I may have missed it ...
  • What I do remember is that every once in a while, the most recent version is not available in defaults and you need to use temporary work-arounds in the CI.
  • there is also the ToS thing, I would guess that we are OK downloading from defaults on an open-source project CI, but at the same time, open-source use case is not explicitly mentioned so 🤷.

For completeness, amongst the CI builds that were still using defaults before this PR:

  • two of them were only using Python from conda and the Python packages were installed with pip: scipy-dev and pylatest_pip_openblas_pandas.
  • the only build still using conda packages was the macOS no-OpenMP one.

@betatim
Copy link
Member

betatim commented Jul 17, 2025

From the overview you gave, in particular that of the only two jobs left using defaults one wasn't really using it, and the fact that I expect less and less people to use defaults because of the new(ly enforced?) license terms I'd also vote to drop defaults all together. (Add to this my personal bias that defaults has nothing to offer over conda-forge ...)

I had a vague memory that there was a particular kind of BLAS (Intel MKL?) that is only available via defaults. But I guess that is just some old memory.

@dawnwages
Copy link

Hey Team! Community & DevRel at Anaconda here. This has been escalated. We are figuring it out and this is not the intended consequence. Hold tight while I figure out why youre getting this message.

New TOS is supposed to provide clarity and allow for open source to do what it does best -- innovate freely.

Following the details for how it applies to PyTorch as well. Issue closed, but threads like these are not the intended consequence.

Give me a beat and Ill follow back up ASAP. Feel free to email me dwages@anaconda.com.

@icfaust
Copy link
Contributor

icfaust commented Jul 17, 2025

@dawnwages is your comment about pytorch related to pytorch/pytorch#158370 ?

@dawnwages
Copy link

Yes @icfaust and any other failures in builds because of the new package. If you see it show up anywhere else we're fixing immediately.

It is incorrect and should not require any changes.

@icfaust
Copy link
Contributor

icfaust commented Jul 17, 2025

@dawnwages It looks as though from this blog post: https://www.anaconda.com/blog/conda-anaconda-tos-plugin
image
That it means that use on CI systems (like azure pipelines) means implicit acceptance of the ToS, which may or may not be desired.

Sorry to have stirred this up in the first place, but wanted to put it here for full transparency.

@dawnwages
Copy link

You're totally right @icfaust and I really appreciate you bringing it up! This is important.

We did not intend to interrupt CI workflows. A fix is coming soon (between an hour and 24 based on cache and workflows).

You can set the CONDA_PLUGINS_AUTO_ACCEPT_TOS environment variable to "yes" to accept the Terms of Service automatically and that will help you right now. Feel free to reach out to community@anaconda.com or my email dwages@anaconda.com.

status page: https://anaconda.statuspage.io/

So sorry for the inconvenience. Bear with us, our open source community are important to us and we're hoping to improve clarity and convenience. A fix is coming soon.

DW

@dawnwages
Copy link

dawnwages commented Jul 17, 2025

CI systems (like azure pipelines) means implicit acceptance of the ToS, which may or may not be desired.

Yes, implicit acceptance. New ToS began July 15, 2025.

Not implicit acceptance, just not required to make developer changes right now. We want to give people a chance to know that ToS acceptance required is coming and make changes to their environment variables to accept. Not everyone is tuned into their build logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment