-
Notifications
You must be signed in to change notification settings - Fork 12
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
conda: command not found for windows-job #87
Comments
If you compare the runner-images of
So we can see that You could fix this like that: - run: echo $CONDA >> $GITHUB_PATH
shell: bash Or use the absolute path for the conda executable # probably C:\Miniconda\conda.exe (?)
- run: C:\Miniconda\conda.exe env export -p [...] |
Alright I just checked what the conda installation on # ls /c/Miniconda/
_conda.exe api-ms-win-core-string-l1-1-0.dll api-ms-win-crt-utility-l1-1-0.dll python.exe
api-ms-win-core-console-l1-1-0.dll api-ms-win-core-synch-l1-1-0.dll concrt140.dll python.pdb
api-ms-win-core-datetime-l1-1-0.dll api-ms-win-core-synch-l1-2-0.dll condabin python3.dll
api-ms-win-core-debug-l1-1-0.dll api-ms-win-core-sysinfo-l1-1-0.dll conda-meta python310.dll
api-ms-win-core-errorhandling-l1-1-0.dll api-ms-win-core-timezone-l1-1-0.dll cwp.py python310.pdb
api-ms-win-core-file-l1-1-0.dll api-ms-win-core-util-l1-1-0.dll DLLs pythonw.exe
api-ms-win-core-file-l1-2-0.dll api-ms-win-crt-conio-l1-1-0.dll envs pythonw.pdb
api-ms-win-core-file-l2-1-0.dll api-ms-win-crt-convert-l1-1-0.dll etc Scripts
api-ms-win-core-handle-l1-1-0.dll api-ms-win-crt-environment-l1-1-0.dll include share
api-ms-win-core-heap-l1-1-0.dll api-ms-win-crt-filesystem-l1-1-0.dll Lib shell
api-ms-win-core-interlocked-l1-1-0.dll api-ms-win-crt-heap-l1-1-0.dll Library Tools
api-ms-win-core-libraryloader-l1-1-0.dll api-ms-win-crt-locale-l1-1-0.dll libs ucrtbase.dll
api-ms-win-core-localization-l1-2-0.dll api-ms-win-crt-math-l1-1-0.dll LICENSE_PYTHON.txt Uninstall-Miniconda3.exe
api-ms-win-core-memory-l1-1-0.dll api-ms-win-crt-multibyte-l1-1-0.dll Menu vccorlib140.dll
api-ms-win-core-namedpipe-l1-1-0.dll api-ms-win-crt-private-l1-1-0.dll msvcp140.dll vcomp140.dll
api-ms-win-core-processenvironment-l1-1-0.dll api-ms-win-crt-process-l1-1-0.dll msvcp140_1.dll vcruntime140.dll
api-ms-win-core-processthreads-l1-1-0.dll api-ms-win-crt-runtime-l1-1-0.dll msvcp140_2.dll vcruntime140_1.dll
api-ms-win-core-processthreads-l1-1-1.dll api-ms-win-crt-stdio-l1-1-0.dll msvcp140_codecvt_ids.dll zlib.dll
api-ms-win-core-profile-l1-1-0.dll api-ms-win-crt-string-l1-1-0.dll pkgs
api-ms-win-core-rtlsupport-l1-1-0.dll api-ms-win-crt-time-l1-1-0.dll pre_uninstall.bat So you should use |
It looks like you can also just use Micromamba instead of Conda. |
I think the conda env export part (especially with pip dependencies) is not directly transferable to micromamba. |
So this works fine (generating a .yml file): /c/Users/runneradmin/micromamba-bin/micromamba.exe env export -p "${MAMBA_ROOT_PREFIX}/envs/${{ runner.os }}" | grep -v "^prefix: " > ./environments/csp_${{ runner.os }}_solved.yml but when executing this (generate an explicit spec-file): /c/Users/runneradmin/micromamba-bin/micromamba.exe list --explicit -p "${MAMBA_ROOT_PREFIX}/envs/${{ runner.os }}" > ./environments/csp_${{ runner.os }}_solved.txt` I got this:
which makes sense because `/c/Users/runneradmin/micromamba-bin/micromamba.exe env export -p "${MAMBA_ROOT_PREFIX}/envs/${{ runner.os }}" --explicit > ./environments/csp_${{ runner.os }}_solved.txt` |
Alright it seems that the docs are out of date. They should point to |
But then I would say the easiest solution would be
If you rely on pip dependencies being added to the export, then you need to call |
Just to be clear here: |
No, only Micromamba will be installed, no Conda |
|
Okay, I completely had to switch back to conda commands for both the Linux and Windows jobs. This is how my code looks now (see full code here): if [ "$RUNNER_OS" == "Windows" ]; then
/c/Miniconda/_conda.exe env export -p "${MAMBA_ROOT_PREFIX}/envs/${{ matrix.os }}" | grep -v "^prefix: " > ./environments/csp_${{ matrix.os }}_solved.yml
/c/Miniconda/_conda.exe list -p "${MAMBA_ROOT_PREFIX}/envs/${{ matrix.os }}" --explicit > ./environments/csp_${{ matrix.os }}_solved.txt
elif [ "$RUNNER_OS" == "Linux" ]; then
conda env export -p "${MAMBA_ROOT_PREFIX}/envs/${{ matrix.os }}" | grep -v "^prefix: " > ./environments/csp_${{ matrix.os }}_solved.yml
conda list -p "${MAMBA_ROOT_PREFIX}/envs/${{ matrix.os }}" --explicit > ./environments/csp_${{ matrix.os }}_solved.txt
fi For the linux-runner, everything works fine but for the windows-runner, I get:
A few take-aways: 1.) Generating a spec-file (as documented here): The command 2.) Generating a |
Btw you can also use this syntax in GitHub actions - run: |
conda env export -p "${MAMBA_ROOT_PREFIX}/envs/${{ matrix.os }}" | grep -v "^prefix: " > ./environments/csp_${{ matrix.os }}_solved.yml
conda list -p "${MAMBA_ROOT_PREFIX}/envs/${{ matrix.os }}" --explicit > ./environments/csp_${{ matrix.os }}_solved.txt
if: runner.os == 'Linux'
- run: |
/c/Miniconda/_conda.exe env export -p "${MAMBA_ROOT_PREFIX}/envs/${{ matrix.os }}" | grep -v "^prefix: " > ./environments/csp_${{ matrix.os }}_solved.yml
/c/Miniconda/_conda.exe list -p "${MAMBA_ROOT_PREFIX}/envs/${{ matrix.os }}" --explicit > ./environments/csp_${{ matrix.os }}_solved.txt
if: runner.os == 'Windows'
My guess would be that conda needs to be initialized for it to work... Did you try running conda init, see here. |
Okay, I solved it.
I followed the steps from this medium post and added the following step to my workflow to initialize conda for Git Bash: - name: initialize conda for Git Bash (will be skipped for Linux)
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
echo ". /c/Miniconda/etc/profile.d/conda.sh" >> ~/.bashrc
fi Interestingly, this step has to be done before running With this approach, it's now also not necessary to use |
I am using a matrix to create a windows and linux job that solve an input .yml file and should output a solved .yml file / spec-file.txt using:
The linux job works fine but for the windows job I get:
conda: command not found
It seems that the shell has not been initialized correctly here? Here's the link to the full code. And here is the output when setting up
setup-micromamba@v1
for the Windows-job:The text was updated successfully, but these errors were encountered: