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

Error on activation of environment on Windows Github Workflow #371

Open
langmm opened this issue Oct 14, 2024 · 3 comments
Open

Error on activation of environment on Windows Github Workflow #371

langmm opened this issue Oct 14, 2024 · 3 comments

Comments

@langmm
Copy link

langmm commented Oct 14, 2024

I am not sure if this is the right place to report so please redirect me if this error is better reported elsewhere.

I have a workflow that uses setup-miniconda. On 10/9/2024 the windows jobs in this workflow started producing the error below when any mamba command is run after the setup step (in particular the environment activation & mamba info). The error appeared in this run (previous run that did not exhibit the error can be found here). The commit on which the error first occurred did not modify the workflow or environment.yml files. I could not find a difference in the package versions installed in the environment, the version of conda/mamba, or the runner image. I tried using miniforge (previously I was using mambaforge as I was unaware of the deprecation, but the same error occurs with miniforge) and pinning mamba to 1.5.10. Any help would be greatly appreciated.

Error message ``` # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
  File "C:\Users\runneradmin\miniconda3\Lib\site-packages\conda\exception_handler.py", line 18, in __call__
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\runneradmin\miniconda3\Lib\site-packages\conda\cli\main.py", line 98, in main_sourced
    context.__init__()
  File "C:\Users\runneradmin\miniconda3\Lib\site-packages\conda\base\context.py", line 497, in __init__
    self._set_search_path(
  File "C:\Users\runneradmin\miniconda3\Lib\site-packages\conda\common\configuration.py", line 1423, in _set_search_path
    self._search_path = IndexedSet(self._expand_search_path(search_path, **kwargs))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\runneradmin\miniconda3\Lib\site-packages\boltons\setutils.py", line 118, in __init__
    self.update(other)
  File "C:\Users\runneradmin\miniconda3\Lib\site-packages\boltons\setutils.py", line 351, in update
    for o in other:
             ^^^^^
  File "C:\Users\runneradmin\miniconda3\Lib\site-packages\conda\common\configuration.py", line 1394, in _expand_search_path
    path = Path(template).expanduser()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\runneradmin\miniconda3\Lib\pathlib.py", line 1406, in expanduser
    raise RuntimeError("Could not determine home directory.")
RuntimeError: Could not determine home directory.

$ C:\Users\runneradmin\miniconda3\Scripts\conda-script.py shell.cmd.exe activate base

environment variables:
CIO_TEST=
CONDA_BAT=C:\Users\runneradmin\miniconda3\condabin\conda.bat
CONDA_EXE=C:\Users\runneradmin\miniconda3\condabin..\Scripts\conda.exe
CONDA_ROOT=C:\Users\runneradmin\miniconda3
CONDA_SHLVL=0
CURL_CA_BUNDLE=
LD_PRELOAD=
PATH=C:\Users\runneradmin\miniconda3\condabin;C:\Users\runneradmin\minicond
a3\envs\ephoto;C:\Users\runneradmin\miniconda3\envs\ephoto\Library\min
gw64\bin;C:\Users\runneradmin\miniconda3\envs\ephoto\Library\mingw-
w64\bin;C:\Users\runneradmin\miniconda3\envs\ephoto\Library\usr\bin;C:
\Users\runneradmin\miniconda3\envs\ephoto\Library\bin;C:\Users\runnera
dmin\miniconda3\envs\ephoto\Scripts;C:\Users\runneradmin\miniconda3\en
vs\ephoto\bin;C:\Users\runneradmin\miniconda3\condabin;C:\Users\runner
admin\bin;C:\Program Files\Git\mingw64\bin;C:\Program
Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program
Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Gi
t\usr\bin;C:\Users\runneradmin\bin;C:\Users\runneradmin\miniconda3\con
dabin;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tool
s\MSVC\14.41.34120\bin\HostX64\x64;C:\Program Files\Microsoft Visual
Studio\2022\Enterprise\Common7\IDE\VC\VCPackages;C:\Program
Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtens
ions\Microsoft\TestWindow;C:\Program Files\Microsoft Visual Studio\202
2\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Tea
m Explorer;C:\Program Files\Microsoft Visual
Studio\2022\Enterprise\MSBuild\Current\bin\Roslyn;C:\Program Files
(x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64;C:\Program
Files (x86)\HTML Help Workshop;C:\Program Files\Microsoft Visual Studi
o\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools;
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team
Tools\DiagnosticsHub\Collector;C:\Program Files\Microsoft Visual Studi
o\2022\Enterprise\Common7\IDE\Extensions\Microsoft\CodeCoverage.Consol
e;C:\Program Files (x86)\Windows
Kits\10\bin\10.0.22621.0\x64;C:\Program Files (x86)\Windows
Kits\10\bin\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterpri
se\MSBuild\Current\Bin\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0
.30319;C:\Program Files\Microsoft Visual
Studio\2022\Enterprise\Common7\IDE;C:\Program Files\Microsoft Visual
Studio\2022\Enterprise\Common7\Tools;C:\Program
Files\MongoDB\Server\5.0\bin;C:\aliyun-cli;C:\vcpkg;C:\Program Files
(x86)\NSIS;C:\tools\zstd;C:\Program Files\Mercurial;C:\hostedtoolcache
\windows\stack\3.1.1\x64;C:\cabal\bin;C:\ghcup\bin;C:\mingw64\bin;C:\P
rogram Files\dotnet;C:\Program Files\MySQL\MySQL Server
8.0\bin;C:\Program Files\R\R-
4.4.1\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\SeleniumWebDrivers
EdgeDriver;C:\SeleniumWebDrivers\ChromeDriver;C:\Program Files
(x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program
Files\Git\usr\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hos
tedtoolcache\windows\go\1.21.13\x64\bin;C:\hostedtoolcache\windows\Pyt
hon\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:
\hostedtoolcache\windows\Ruby\3.0.7\x64\bin;C:\Program Files\OpenSSL\b
in;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-
Hotspot_jdk\8.0.422-5\x64\bin;C:\Program
Files\ImageMagick-7.1.1-Q16-HDRI;C:\Program Files\Microsoft SDKs\Azure
\CLI2\wbin;C:\ProgramData\kind;C:\ProgramData\Chocolatey\bin;C:\Window
s\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Win
dowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program
Files\dotnet;C:\Program Files\PowerShell\7;C:\Program
Files\Microsoft\Web Platform Installer;C:\Program
Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\Client
SDK\ODBC\170\Tools\Binn;C:\Program Files\Microsoft SQL
Server\150\Tools\Binn;C:\Program Files (x86)\Windows Kits\10\Windows
Performance Toolkit;C:\Program Files (x86)\WiX Toolset
v3.14\bin;C:\Program Files\Microsoft SQL
Server\130\DTS\Binn;C:\Program Files\Microsoft SQL
Server\140\DTS\Binn;C:\Program Files\Microsoft SQL
Server\150\DTS\Binn;C:\Program Files\Microsoft SQL Server\160\DTS\Binn
;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bi
n;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program
Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-
maven-3.8.7\bin;C:\Program Files\Microsoft Service
Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service
Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program
Files\nodejs;C:\Program Files\Git\cmd;C:\Program
Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program
Files\GitHub CLI;C:\tools\php;C:\Program
Files\Amazon\AWSCLIV2;C:\Program
Files\Amazon\SessionManagerPlugin\bin;C:\Program
Files\Amazon\AWSSAMCLI\bin;C:\Program Files\Microsoft SQL
Server\130\Tools\Binn;C:\Program Files\LLVM\bin;C:\Users\runneradmin.
dotnet\tools;C:\Users\runneradmin.cargo\bin;C:\Users\runneradmin\AppD
ata\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft
Visual Studio\Installer;C:\Program Files\Microsoft Visual
Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin;C:\Program
Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtens
ions\Microsoft\CMake\CMake\bin;C:\Program Files\Microsoft Visual Studi
o\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C
:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\VC
\Linux\bin\ConnectionManagerExe;C:\Program Files\Microsoft Visual
Studio\2022\Enterprise\VC\vcpkg;C:\Program
Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
REQUESTS_CA_BUNDLE=
SSL_CERT_FILE=

 active environment : None
        shell level : 0
   user config file : D:\a\ePhotosynthesis_C\ePhotosynthesis_C\~\.condarc

populated config files :
conda version : 24.7.1
conda-build version : not installed
python version : 3.12.6.final.0
solver : libmamba (default)
virtual packages : __archspec=1=x86_64_v3
__conda=24.7.1=0
__win=0=0
base environment : C:\Users\runneradmin\miniconda3 (writable)
conda av data dir : C:\Users\runneradmin\miniconda3\etc\conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\runneradmin\miniconda3\pkgs
D:\a\ePhotosynthesis_C\ePhotosynthesis_C~.conda\pkgs
C:\Users\runneradmin\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\runneradmin\miniconda3\envs
D:\a\ePhotosynthesis_C\ePhotosynthesis_C~.conda\envs
C:\Users\runneradmin\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/24.7.1 requests/2.32.3 CPython/3.12.6 Windows/2022Server Windows/10.0.20348 solver/libmamba conda-libmamba-solver/24.7.0 libmambapy/1.5.9
administrator : True
netrc file : None
offline mode : False

An unexpected error has occurred. Conda has prepared the above report.
If you suspect this error is being caused by a malfunctioning plugin,
consider using the --no-plugins option to turn off plugins.

Example: conda --no-plugins install

Alternatively, you can set the CONDA_NO_PLUGINS environment variable on
the command line to run the command without plugins enabled.

Example: CONDA_NO_PLUGINS=true conda install

No report sent. To permanently opt-out, use

$ conda config --set report_errors false
</details>
@langmm langmm changed the title Error on activation of environment on Windows Github Action Error on activation of environment on Windows Github Workflow Oct 14, 2024
@jaimergp
Copy link
Member

Hm, it's odd indeed. The error comes all the way from the Python standard library because it can't parse ~ in the passed paths. I wonder if some of the necessary env vars are being shadowed or something. From the docs:

On Windows, USERPROFILE will be used if set, otherwise a combination of HOMEPATH and HOMEDRIVE will be used. An initial ~user is handled by checking that the last directory component of the current user’s home directory matches USERNAME, and replacing it if so.

Maybe you can manually set USERPROFILE=${{ github.workspace }} in that step, or similar?

@langmm
Copy link
Author

langmm commented Oct 15, 2024

I just tried setting USERPROFILE=${{ github.workspace }}, but the same error occurred. Based on your comment about the environment variables, I also checked the environment variables that were set before/after the error started occurring, but there was not any difference.

@brynpickering
Copy link

brynpickering commented Nov 6, 2024

We're having the same issue on projects, where we rely on a composite action to create the environment and then have additional steps which run in that env. This worked fine until this week, but now fails only on Windows in the first step after the composite action, irrespective of what that step might entail.

E.g.:

  pytest --no-cov
  shell: C:\Program Files\Git\bin\bash.EXE -l {0}
  env:
    MAMBAENVNAME: windows-latest-311
    INPUT_RUN_POST: true
    CONDA: C:\Users\runneradmin\miniconda3
D:\a\_temp\b89dbe25-049b-48a0-93e0-00de38b06619.sh: line 1: pytest: command not found
Error: Process completed with exit code 127.

And:

Run python -m ipykernel install --user --name [repo-name]
  python -m ipykernel install --user --name [repo-name]
  shell: C:\Program Files\Git\bin\bash.EXE -l {0}
  env:
    MAMBAENVNAME: windows-latest-310
    INPUT_RUN_POST: true
    CONDA: C:\Users\runneradmin\miniconda3
C:\hostedtoolcache\windows\Python\3.9.13\x64\python.exe: No module named ipykernel

Before the error occured, there was one more env var, CONDA_PKGS_DIR (not actively added or removed by us):

Run python -m ipykernel install --user --name [repo-name]
  python -m ipykernel install --user --name [repo-name]
  shell: C:\Program Files\Git\bin\bash.EXE -l {0}
  env:
    MAMBAENVNAME: windows-latest-310
    INPUT_RUN_POST: true
    CONDA: C:\Users\runneradmin\miniconda3
    CONDA_PKGS_DIR: C:\Users\runneradmin\conda_pkgs_dir
Installed kernelspec [repo-name] in C:\Users\runneradmin\AppData\Roaming\jupyter\kernels\[repo-name]

schmoelder added a commit to fau-advanced-separations/CADET-Process that referenced this issue Nov 14, 2024
Currently, a bug in setup-miniconda leads to conda not being activated
which makes all tests fail. For more information, refer to:
conda-incubator/setup-miniconda#371
schmoelder added a commit to fau-advanced-separations/CADET-Process that referenced this issue Nov 14, 2024
Currently, a bug in setup-miniconda leads to conda not being activated
which makes all tests fail. For more information, refer to:
conda-incubator/setup-miniconda#371
ronald-jaepel pushed a commit to fau-advanced-separations/CADET-Process that referenced this issue Nov 14, 2024
Currently, a bug in setup-miniconda leads to conda not being activated
which makes all tests fail. For more information, refer to:
conda-incubator/setup-miniconda#371
schmoelder added a commit to fau-advanced-separations/CADET-Process that referenced this issue Dec 16, 2024
Currently, a bug in setup-miniconda leads to conda not being activated
which makes all tests fail. For more information, refer to:
conda-incubator/setup-miniconda#371
bnavigator added a commit to bnavigator/Slycot that referenced this issue Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants