conda-incubator / setup-miniconda

Set up your GitHub Actions workflow with conda via miniconda

Home Page:https://github.com/marketplace/actions/setup-miniconda

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Environment not activated with miniforge on windows

k-dominik opened this issue · comments

Hello there,

first of all thank you for developing/maintaining such a useful package.

I recently started using miniforge locally for everything, and thought I want to mirror this on CI, too.
On windows it doesn't seem to activate the environment (here test-env ) though.

This version does not work:

      - uses: conda-incubator/setup-miniconda@v3
        with:
          activate-environment: test-env
          miniforge-version: latest
          auto-update-conda: true
          conda-solver: libmamba
      - name: windows test
        shell: cmd /C CALL {0}
        run: >-
          conda info && conda list  && SET

whereas the one not using miniforge works:

      - uses: conda-incubator/setup-miniconda@v3
        with:
          activate-environment: test-env
          auto-update-conda: true
          conda-solver: libmamba
      - name: windows test
        shell: cmd /C CALL {0}
        run: >-
          conda info && conda list  && SET

Would be cool if this could get fixed. Not a typescript person, otherwise I'd chomp through the code myself. Of course if you have any pointers where to look at specifically, will be happy to do so.

Cheers
Dominik

Hi @k-dominik, thanks for the kind words and the issue you raise.

Could you point us to the repo CI runs where this is running so we can check?

Also is this a regression from version 2? Does conda-incubator/setup-miniconda@v2, work as expected?

Cheers!

Hi @goanpeca,

thank you so much for the quick response! I created a repo to reproduce the issue and it seems that it worked with v2. An example run can be seen here: https://github.com/k-dominik/setup-miniconda-repro/actions/runs/7022127921/job/19105767838

Ok. looked into that:

That reveals:

  • the old v2 action installs to C:/Miniconda3... the new v3 action install to C:/Users/runneradmin/miniconda3/... that should be intended for better self hosted runner support
  • The append section in the v2 contains this 3 appends (missing in the v3 log):
Append to "C:/Miniconda3/etc/profile.d/conda.sh":
 
  # ----------------------------------------------------------------------------
  # Conda Setup Action: Basic configuration
  set -eo pipefail
  # Conda Setup Action: Custom activation
  conda activate "test-env"
  # ---------------------------------------------------------------------------- 

Append to "C:/Miniconda3/etc/fish/conf.d/conda.fish":
 
  # ----------------------------------------------------------------------------
  # Conda Setup Action: Basic configuration
  set -eo pipefail
  # Conda Setup Action: Custom activation
  conda activate "test-env"
  # ---------------------------------------------------------------------------- 

Append to "C:/Miniconda3/condabin/conda_hook.bat":
 
  :: ---------------------------------------------------------------------------
  :: Conda Setup Action: Activate base
  @CALL "%CONDA_BAT%" activate base
  :: Conda Setup Action: Custom activation
  @CALL "%CONDA_BAT%" activate "test-env"
  :: Conda Setup Action: Basic configuration
  @SETLOCAL EnableExtensions
  @SETLOCAL DisableDelayedExpansion
  :: --------------------------------------------------------------------------- 
  • still v3 correctly appends the other files
Append to "C:\Users\runneradmin/.bash_profile":
 
  # ----------------------------------------------------------------------------
  # Conda Setup Action: Basic configuration
  set -eo pipefail
  # Conda Setup Action: Custom activation
  conda activate "test-env"
  # ---------------------------------------------------------------------------- 

Append to "C:\Users\runneradmin/.zshrc":
 
  # ----------------------------------------------------------------------------
  # Conda Setup Action: Basic configuration
  set -eo pipefail
  # Conda Setup Action: Custom activation
  conda activate "test-env"
  # ---------------------------------------------------------------------------- 

Append to "C:\Users\runneradmin/.config/fish/config.fish":
 
  # ----------------------------------------------------------------------------
  # Conda Setup Action: Basic configuration
  set -eo pipefail
  # Conda Setup Action: Custom activation
  conda activate "test-env"
  # ---------------------------------------------------------------------------- 

Append to "C:\Users\runneradmin/.tcshrc":
 
  # ----------------------------------------------------------------------------
  # Conda Setup Action: Basic configuration
  set -eo pipefail
  # Conda Setup Action: Custom activation
  conda activate "test-env"
  # ---------------------------------------------------------------------------- 

Append to "C:\Users\runneradmin/.xonshrc":
 
  # ----------------------------------------------------------------------------
  # Conda Setup Action: Basic configuration
  set -eo pipefail
  # Conda Setup Action: Custom activation
  conda activate "test-env"
  # ---------------------------------------------------------------------------- 

Append to "C:\Users\runneradmin/Documents/PowerShell/profile.ps1":
 
  # ----------------------------------------------------------------------------
  # Conda Setup Action: Custom activation
  conda activate "test-env"
  # ---------------------------------------------------------------------------- 

Append to "C:\Users\runneradmin/Documents/WindowsPowerShell/profile.ps1":
 
  # ----------------------------------------------------------------------------
  # Conda Setup Action: Custom activation
  conda activate "test-env"
  # ---------------------------------------------------------------------------- 

Why are those 3 appends missing in the v3 log: conda.sh, conda.fish and conda_hook.bat, but everything else is appended correctly?

tldr: seems to be bug in the v3 action. Unclear where it comes from

Could be a bug in the lines https://github.com/conda-incubator/setup-miniconda/blob/main/src/conda.ts#L288 where the location is still hardcoded ...

@k-dominik Thanks for the report. 3.0.1. is out and should fix this.

Hi @dbast and @goanpeca,

thank you so much for fixing this so quickly :) great that Miniforge works now!

Have a great rest of the week!
Cheers
Dominik