From 53371537616925ceaf13a2e55a55397eeaf684ad Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 15 Sep 2022 15:14:48 +0530 Subject: [PATCH 1/5] Remove the use of activate.d for the windows installer, since it allows for easier debugging later on --- build.bat | 8 +++----- build.sh | 3 +++ scripts/Start Stable Diffusion UI.cmd | 11 ++++++++++- scripts/start.sh | 3 +++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/build.bat b/build.bat index d1bcaab7..0cc6cf3f 100644 --- a/build.bat +++ b/build.bat @@ -8,6 +8,8 @@ set /p answer=Are you a developer of this project (Y/N)? if /i "%answer:~,1%" NEQ "Y" exit /b +@set PYTHONNOUSERSITE=1 + @mkdir dist\stable-diffusion-ui @echo "Downloading components for the installer.." @@ -15,11 +17,6 @@ if /i "%answer:~,1%" NEQ "Y" exit /b @call conda env create --prefix installer -f environment.yaml @call conda activate .\installer -@echo "Setting up startup scripts.." - -@mkdir installer\etc\conda\activate.d -@copy scripts\post_activate.bat installer\etc\conda\activate.d\ - @echo "Creating a distributable package.." @call conda install -c conda-forge -y conda-pack @@ -37,6 +34,7 @@ if /i "%answer:~,1%" NEQ "Y" exit /b @copy ..\..\LICENSE . @copy "..\..\CreativeML Open RAIL-M License" . @copy "..\..\How to install and run.txt" . +@echo "" > scripts\install_status.txt @echo "Build ready. Zip the 'dist\stable-diffusion-ui' folder." diff --git a/build.sh b/build.sh index 04579d1f..577dcb8b 100755 --- a/build.sh +++ b/build.sh @@ -11,6 +11,8 @@ case $yn in * ) exit;; esac +export PYTHONNOUSERSITE=1 + mkdir -p dist/stable-diffusion-ui echo "Downloading components for the installer.." @@ -38,6 +40,7 @@ cp ../../scripts/start.sh . cp ../../LICENSE . cp "../../CreativeML Open RAIL-M License" . cp "../../How to install and run.txt" . +echo "" > scripts/install_status.txt chmod u+x start.sh diff --git a/scripts/Start Stable Diffusion UI.cmd b/scripts/Start Stable Diffusion UI.cmd index 4f67c7bf..6bf6b290 100644 --- a/scripts/Start Stable Diffusion UI.cmd +++ b/scripts/Start Stable Diffusion UI.cmd @@ -1 +1,10 @@ -installer\Scripts\activate.bat +@call installer\Scripts\activate.bat + +@call conda-unpack + +@call conda --version +@call git --version + +@call scripts\on_env_start.bat + +@pause \ No newline at end of file diff --git a/scripts/start.sh b/scripts/start.sh index d6c75ad8..e077593a 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -4,4 +4,7 @@ source installer/bin/activate conda-unpack +conda --version +git --version + scripts/on_env_start.sh From 5facba441946bb62555591fa3cf8b6c1438b5f11 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sat, 24 Sep 2022 23:23:35 +0530 Subject: [PATCH 2/5] [installer] No need to go back a folder now, we're already in the right location --- build.bat | 2 +- scripts/on_env_start.bat | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/build.bat b/build.bat index 0cc6cf3f..96232c0a 100644 --- a/build.bat +++ b/build.bat @@ -34,7 +34,7 @@ if /i "%answer:~,1%" NEQ "Y" exit /b @copy ..\..\LICENSE . @copy "..\..\CreativeML Open RAIL-M License" . @copy "..\..\How to install and run.txt" . -@echo "" > scripts\install_status.txt +@echo. > scripts\install_status.txt @echo "Build ready. Zip the 'dist\stable-diffusion-ui' folder." diff --git a/scripts/on_env_start.bat b/scripts/on_env_start.bat index 16312a5a..959b5e20 100644 --- a/scripts/on_env_start.bat +++ b/scripts/on_env_start.bat @@ -4,8 +4,6 @@ set PATH=C:\Windows\System32;%PATH% -@cd .. - if exist "scripts\config.bat" ( @call scripts\config.bat ) From 489aae7a468675de7bafee007cd666faad6dc4ca Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sun, 25 Sep 2022 00:03:15 +0530 Subject: [PATCH 3/5] Put back the System32 fix --- scripts/on_env_start.bat | 2 +- scripts/on_sd_start.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/on_env_start.bat b/scripts/on_env_start.bat index 8e46c62c..16312a5a 100644 --- a/scripts/on_env_start.bat +++ b/scripts/on_env_start.bat @@ -2,7 +2,7 @@ @echo. & echo "Stable Diffusion UI - v2" & echo. -@REM set PATH=C:\Windows\System32;%PATH% +set PATH=C:\Windows\System32;%PATH% @cd .. diff --git a/scripts/on_sd_start.bat b/scripts/on_sd_start.bat index 8c422865..b8ef042b 100644 --- a/scripts/on_sd_start.bat +++ b/scripts/on_sd_start.bat @@ -79,7 +79,7 @@ @echo conda_sd_env_created >> ..\scripts\install_status.txt ) -@REM set PATH=C:\Windows\System32;%PATH% +set PATH=C:\Windows\System32;%PATH% @>nul grep -c "conda_sd_gfpgan_deps_installed" ..\scripts\install_status.txt @if "%ERRORLEVEL%" EQU "0" ( From b3e9b266fa2b9a958bc384ef1f4f20fa6178c7e4 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Mon, 26 Sep 2022 12:05:07 +0530 Subject: [PATCH 4/5] Use python 3.8.13 instead of 3.8.5, since 3.8.5 seems to be missing openssl in some pip repositories --- ui/sd_internal/env_yaml.patch | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ui/sd_internal/env_yaml.patch b/ui/sd_internal/env_yaml.patch index cc140ef1..ba4d2a19 100644 --- a/ui/sd_internal/env_yaml.patch +++ b/ui/sd_internal/env_yaml.patch @@ -1,7 +1,16 @@ diff --git a/environment.yaml b/environment.yaml -index 7f25da8..306750f 100644 +index 7f25da8..19ddcd8 100644 --- a/environment.yaml +++ b/environment.yaml +@@ -3,7 +3,7 @@ channels: + - pytorch + - defaults + dependencies: +- - python=3.8.5 ++ - python=3.8.13 + - pip=20.3 + - cudatoolkit=11.3 + - pytorch=1.11.0 @@ -23,6 +23,8 @@ dependencies: - torch-fidelity==0.3.0 - transformers==4.19.2 From 2a46f6b225ea9cd4f357582af0277fe7b5d1b5fc Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Mon, 26 Sep 2022 19:19:11 +0530 Subject: [PATCH 5/5] Make the new installer work with existing installations (made with the old installer) --- scripts/Start Stable Diffusion UI.cmd | 9 +++++++++ scripts/on_env_start.bat | 2 ++ 2 files changed, 11 insertions(+) diff --git a/scripts/Start Stable Diffusion UI.cmd b/scripts/Start Stable Diffusion UI.cmd index 6bf6b290..e34c2b36 100644 --- a/scripts/Start Stable Diffusion UI.cmd +++ b/scripts/Start Stable Diffusion UI.cmd @@ -1,3 +1,10 @@ +@echo off + +@REM Delete the post-activate hook from the old installer +@if exist "installer\etc\conda\activate.d\post_activate.bat" ( + del "installer\etc\conda\activate.d\post_activate.bat" +) + @call installer\Scripts\activate.bat @call conda-unpack @@ -5,6 +12,8 @@ @call conda --version @call git --version +@cd installer + @call scripts\on_env_start.bat @pause \ No newline at end of file diff --git a/scripts/on_env_start.bat b/scripts/on_env_start.bat index 959b5e20..16312a5a 100644 --- a/scripts/on_env_start.bat +++ b/scripts/on_env_start.bat @@ -4,6 +4,8 @@ set PATH=C:\Windows\System32;%PATH% +@cd .. + if exist "scripts\config.bat" ( @call scripts\config.bat )