feat: use existing virtualenv if already active
This commit is contained in:
parent
22bcc7be42
commit
0d2cf9ac18
35
webui.sh
35
webui.sh
@ -152,24 +152,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; }
|
cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "\n%s\n" "${delimiter}"
|
if [[ -z "${VIRTUAL_ENV}" ]];
|
||||||
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
|
then
|
||||||
"${python_cmd}" -m venv "${venv_dir}"
|
printf "\n%s\n" "${delimiter}"
|
||||||
first_launch=1
|
printf "Create and activate python venv"
|
||||||
fi
|
printf "\n%s\n" "${delimiter}"
|
||||||
# shellcheck source=/dev/null
|
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 [[ -f "${venv_dir}"/bin/activate ]]
|
if [[ ! -d "${venv_dir}" ]]
|
||||||
then
|
then
|
||||||
source "${venv_dir}"/bin/activate
|
"${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
|
else
|
||||||
printf "\n%s\n" "${delimiter}"
|
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}"
|
printf "\n%s\n" "${delimiter}"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z "${ACCELERATE}" ]] && [ ${ACCELERATE}="True" ] && [ -x "$(command -v accelerate)" ]
|
if [[ ! -z "${ACCELERATE}" ]] && [ ${ACCELERATE}="True" ] && [ -x "$(command -v accelerate)" ]
|
||||||
|
Loading…
Reference in New Issue
Block a user