From a281efef0445f157c94698ddb4663013a82e6609 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Tue, 25 Oct 2022 18:07:29 +0530 Subject: [PATCH] deactivate any pre-activated conda environments, by returning to (base) and then deactivating that. On Windows and Linux --- scripts/on_sd_start.bat | 4 ++++ scripts/on_sd_start.sh | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/on_sd_start.bat b/scripts/on_sd_start.bat index 0418895d..096538f6 100644 --- a/scripts/on_sd_start.bat +++ b/scripts/on_sd_start.bat @@ -68,6 +68,10 @@ if exist "%cd%\profile" ( set TMP=%cd%\tmp set TEMP=%cd%\tmp + @REM deactivate any pre-activated conda environments, by returning to (base) and then deactivating that + call conda activate + call conda deactivate + @call conda env create --prefix env -f environment.yaml || ( @echo. & echo "Error installing the packages necessary for Stable Diffusion. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. pause diff --git a/scripts/on_sd_start.sh b/scripts/on_sd_start.sh index d0036f51..55e00d22 100755 --- a/scripts/on_sd_start.sh +++ b/scripts/on_sd_start.sh @@ -6,11 +6,6 @@ cp sd-ui-files/scripts/bootstrap.sh scripts/ CONDA_BASEPATH=$(conda info --base) source "$CONDA_BASEPATH/etc/profile.d/conda.sh" # otherwise conda complains about 'shell not initialized' (needed when running in a script) -# deactivate any pre-activated conda environments -for i in $(seq ${CONDA_SHLVL}); do - conda deactivate -done - # remove the old version of the dev console script, if it's still present if [ -e "open_dev_console.sh" ]; then rm "open_dev_console.sh" @@ -67,6 +62,10 @@ else # prevent conda from using packages from the user's home directory, to avoid conflicts export PYTHONNOUSERSITE=1 + # deactivate any pre-activated conda environments, by returning to (base) and then deactivating that + conda activate + conda deactivate + if conda env create --prefix env --force -f environment.yaml ; then echo "Installed. Testing.." else