diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-10-28 13:23:41 -0400 | 
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-10-28 13:23:41 -0400 | 
| commit | 36f3a828dd068c50b84815a02ad66e6616c8fdaf (patch) | |
| tree | 62e1088cf1d6eca113ccb1f0e04b4c916c2e1c11 | |
| parent | 4f24068ea3319f3e156431753064527cb695995c (diff) | |
| download | stasis-36f3a828dd068c50b84815a02ad66e6616c8fdaf.tar.gz | |
Workaround for latest conda regression
* profile.d/{conda,mamba}.sh don't set PATH so "import conda" and "import mamba" fail when conda is invoked. Fantastic.
* Put conda's python interpreter on the PATH before using conda for the first time
| -rw-r--r-- | src/lib/core/conda.c | 4 | 
1 files changed, 3 insertions, 1 deletions
| diff --git a/src/lib/core/conda.c b/src/lib/core/conda.c index 5954f20..c2cea0e 100644 --- a/src/lib/core/conda.c +++ b/src/lib/core/conda.c @@ -218,11 +218,13 @@ int conda_activate(const char *root, const char *env_name) {      const char *init_script_mamba = "/etc/profile.d/mamba.sh";      char path_conda[PATH_MAX] = {0};      char path_mamba[PATH_MAX] = {0}; +    char path_bin[PATH_MAX] = {0};      char logfile[PATH_MAX] = {0};      struct Process proc;      memset(&proc, 0, sizeof(proc));      // Where to find conda's init scripts +    sprintf(path_bin, "%s/bin", root);      sprintf(path_conda, "%s%s", root, init_script_conda);      sprintf(path_mamba, "%s%s", root, init_script_mamba); @@ -256,7 +258,7 @@ int conda_activate(const char *root, const char *env_name) {      // Fully activate conda and record its effect on the runtime environment      char command[PATH_MAX * 3]; -    snprintf(command, sizeof(command) - 1, "set -a; source %s; source %s; conda activate %s &>/dev/null; env -0", path_conda, path_mamba, env_name); +    snprintf(command, sizeof(command) - 1, "set -a; source %s; source %s; PATH=\"%s:$PATH\" conda activate %s &>/dev/null; env -0", path_conda, path_mamba, path_bin, env_name);      int retval = shell(&proc, command);      if (retval) {          // it didn't work; drop out for cleanup | 
