Skip to content

Commit

Permalink
clean up legacy Python Venv on first launch
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcitec committed Sep 28, 2024
1 parent e45fb13 commit dd150ff
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib.include.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ function activate_python_venv {
export OT_PYTHON_CMD="python"
}

function remove_legacy_venv {
# Removes the legacy "venv" sub-directory from OneTrainer's directory.
if [[ -d "venv" ]]; then
print "Cleaning up legacy Python Venv environment in \"venv\"..."
rm -rfv "venv"
fi
}

# Conda command wrappers.
function run_conda {
print "+ ${OT_CONDA_CMD} $*"
Expand Down Expand Up @@ -298,6 +306,9 @@ function exit_if_active_env_wrong_python_version {

# Performs the most important startup sanity checks and environment preparation.
function prepare_runtime_environment {
# Clean up the legacy "venv" if it exists.
remove_legacy_venv

# Ensure that the chosen Conda or Python runtime exists.
exit_if_no_runtime

Expand Down

0 comments on commit dd150ff

Please sign in to comment.