From ee4d468bcebad35580febd576949605508d7d079 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 15 Sep 2022 12:06:37 +0530 Subject: [PATCH] Force-install antlr4, since pip (incorrectly) skips installing it occasionally --- scripts/on_sd_start.bat | 6 ++++++ scripts/on_sd_start.sh | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/scripts/on_sd_start.bat b/scripts/on_sd_start.bat index 0361c51b..4ad08352 100644 --- a/scripts/on_sd_start.bat +++ b/scripts/on_sd_start.bat @@ -62,6 +62,12 @@ @call conda activate .\env + @call conda install -c conda-forge -y --prefix env antlr4-python3-runtime=4.8 || ( + @echo. & echo "Error installing antlr4-python3-runtime 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/blob/main/Troubleshooting.md" & 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 + exit /b + ) + for /f "tokens=*" %%a in ('python -c "import torch; import ldm; import transformers; import numpy; import antlr4; print(42)"') do if "%%a" NEQ "42" ( @echo. & echo "Dependency test failed! 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/blob/main/Troubleshooting.md" & 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 b999bc63..a9329c33 100755 --- a/scripts/on_sd_start.sh +++ b/scripts/on_sd_start.sh @@ -63,6 +63,14 @@ else conda activate ./env + if conda install -c conda-forge --prefix ./env -y antlr4-python3-runtime=4.8 ; then + echo "Installed. Testing.." + else + printf "\n\nError installing antlr4-python3-runtime for Stable Diffusion. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 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\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n" + read -p "Press any key to continue" + exit + fi + out_test=`python -c "import torch; import ldm; import transformers; import numpy; import antlr4; print(42)"` if [ "$out_test" != "42" ]; then printf "\n\nDependency test failed! Error installing the packages necessary for Stable Diffusion. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 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\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"