diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-05-02 08:05:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 08:05:00 +0000 |
commit | 335428c2c8139dfe07ba096a6defa75036660244 (patch) | |
tree | e4a7870441086ec77918c88c66c31aff9f844d36 | |
parent | 14b70aa97ba356691254055a67b9eb2ec3440b3e (diff) | |
parent | 0d2cf9ac186fc87cc56fce2a4e1136aca2386252 (diff) | |
download | stable-diffusion-webui-gfx803-335428c2c8139dfe07ba096a6defa75036660244.tar.gz stable-diffusion-webui-gfx803-335428c2c8139dfe07ba096a6defa75036660244.tar.bz2 stable-diffusion-webui-gfx803-335428c2c8139dfe07ba096a6defa75036660244.zip |
Merge pull request #9140 from yedpodtrzitko/yed/reuse-existing-venv
feat: use existing virtualenv if already active
-rwxr-xr-x | webui.sh | 35 |
1 files changed, 21 insertions, 14 deletions
@@ -153,24 +153,31 @@ else cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; } fi -printf "\n%s\n" "${delimiter}" -printf "Create and activate python venv" -printf "\n%s\n" "${delimiter}" -cd "${install_dir}"/"${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; } -if [[ ! -d "${venv_dir}" ]] -then - "${python_cmd}" -m venv "${venv_dir}" - first_launch=1 -fi -# shellcheck source=/dev/null -if [[ -f "${venv_dir}"/bin/activate ]] +if [[ -z "${VIRTUAL_ENV}" ]]; then - source "${venv_dir}"/bin/activate + printf "\n%s\n" "${delimiter}" + printf "Create and activate python venv" + printf "\n%s\n" "${delimiter}" + cd "${install_dir}"/"${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; } + if [[ ! -d "${venv_dir}" ]] + then + "${python_cmd}" -m venv "${venv_dir}" + first_launch=1 + fi + # shellcheck source=/dev/null + if [[ -f "${venv_dir}"/bin/activate ]] + then + source "${venv_dir}"/bin/activate + else + printf "\n%s\n" "${delimiter}" + printf "\e[1m\e[31mERROR: Cannot activate python venv, aborting...\e[0m" + printf "\n%s\n" "${delimiter}" + exit 1 + fi else printf "\n%s\n" "${delimiter}" - printf "\e[1m\e[31mERROR: Cannot activate python venv, aborting...\e[0m" + printf "python venv already activate: ${VIRTUAL_ENV}" printf "\n%s\n" "${delimiter}" - exit 1 fi # Try using TCMalloc on Linux |