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:
- downloaded the log archive from https://github.com/k-dominik/setup-miniconda-repro/actions/runs/7022127921/job/19105768368
- 3 out of 4 runs are ok... only the miniforge with the v3 action is broken
- stripped of the timestamps via
cat 0_test-w-miniforge-v2.txt | cut -c 30- > good.txt
andcat 0_test-w-miniforge-v3.txt | cut -c 30- > bad.txt
- compared both log files graphically via
meld good.txt bad.txt
.
That reveals:
- the old v2 action installs to
C:/Miniconda3
... the new v3 action install toC:/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.