From ef46603f4ef4a8120d2232651bbaceb3420f69f2 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Mon, 12 Sep 2022 16:39:23 +0530 Subject: [PATCH] Tell conda to skip any pre-installed packages in the users' home/.local folder, since that can cause conflicts --- scripts/on_sd_start.bat | 9 +++++++++ scripts/on_sd_start.sh | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/on_sd_start.bat b/scripts/on_sd_start.bat index 9f993ec2..5df1bc7d 100644 --- a/scripts/on_sd_start.bat +++ b/scripts/on_sd_start.bat @@ -46,6 +46,9 @@ @rmdir /s /q .\env + @REM prevent conda from using packages from the user's home directory, to avoid conflicts + @set PYTHONNOUSERSITE=1 + @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/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 @@ -69,6 +72,8 @@ ) else ( @echo. & echo "Downloading packages necessary for GFPGAN (Face Correction).." & echo. + @set PYTHONNOUSERSITE=1 + @call pip install -e git+https://github.com/TencentARC/GFPGAN#egg=GFPGAN || ( @echo. & echo "Error installing the packages necessary for GFPGAN (Face Correction). 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 @@ -90,6 +95,8 @@ ) else ( @echo. & echo "Downloading packages necessary for ESRGAN (Resolution Upscaling).." & echo. + @set PYTHONNOUSERSITE=1 + @call pip install -e git+https://github.com/xinntao/Real-ESRGAN#egg=realesrgan || ( @echo. & echo "Error installing the packages necessary for ESRGAN (Resolution Upscaling). 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 @@ -111,6 +118,8 @@ ) else ( @echo. & echo "Downloading packages necessary for Stable Diffusion UI.." & echo. + @set PYTHONNOUSERSITE=1 + @call conda install -c conda-forge -y --prefix env uvicorn fastapi || ( echo "Error installing the packages necessary for Stable Diffusion UI. 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!" pause diff --git a/scripts/on_sd_start.sh b/scripts/on_sd_start.sh index b50a5546..5b0874cc 100755 --- a/scripts/on_sd_start.sh +++ b/scripts/on_sd_start.sh @@ -45,6 +45,9 @@ else printf "\n\nDownloading packages necessary for Stable Diffusion..\n" printf "\n\n***** This will take some time (depending on the speed of the Internet connection) and may appear to be stuck, but please be patient ***** ..\n\n" + # prevent conda from using packages from the user's home directory, to avoid conflicts + export PYTHONNOUSERSITE=1 + if conda env create --prefix env --force -f environment.yaml ; then echo "Installed. Testing.." else @@ -70,6 +73,8 @@ if [ `grep -c conda_sd_gfpgan_deps_installed ../scripts/install_status.txt` -gt else printf "\n\nDownloading packages necessary for GFPGAN (Face Correction)..\n" + export PYTHONNOUSERSITE=1 + if pip install -e git+https://github.com/TencentARC/GFPGAN#egg=GFPGAN ; then echo "Installed. Testing.." else @@ -93,6 +98,8 @@ if [ `grep -c conda_sd_esrgan_deps_installed ../scripts/install_status.txt` -gt else printf "\n\nDownloading packages necessary for ESRGAN (Resolution Upscaling)..\n" + export PYTHONNOUSERSITE=1 + if pip install -e git+https://github.com/xinntao/Real-ESRGAN#egg=realesrgan ; then echo "Installed. Testing.." else @@ -116,6 +123,8 @@ if [ `grep -c conda_sd_ui_deps_installed ../scripts/install_status.txt` -gt "0" else printf "\n\nDownloading packages necessary for Stable Diffusion UI..\n\n" + export PYTHONNOUSERSITE=1 + if conda install -c conda-forge --prefix ./env -y uvicorn fastapi ; then echo "Installed. Testing.." else @@ -276,4 +285,4 @@ cd stable-diffusion uvicorn server:app --app-dir "$SD_UI_PATH" --port 9000 --host 0.0.0.0 -read -p "Press any key to continue" \ No newline at end of file +read -p "Press any key to continue"