Skip to content

Commit

Permalink
Merge pull request #388 from HopkinsIDD/fix-activate-conda-breaking-h…
Browse files Browse the repository at this point in the history
…pc-init

Deactivate Conda Env In HPC Init Script
  • Loading branch information
TimothyWillard authored Nov 8, 2024
2 parents 092069a + c4264ba commit b07b9f6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions batch/hpc_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ if [ -z "${FLEPI_CONDA}" ]; then
fi
echo "Using '$FLEPI_CONDA' for \$FLEPI_CONDA."
fi
CURRENT_CONDA_ENV=$( conda info | grep "active environment" | awk -F ':' '{print $2}' | xargs )
if [ "$CURRENT_CONDA_ENV" = "$FLEPI_CONDA" ]; then
echo "Detected the activate conda environment is '$FLEPI_CONDA' already, but will refresh."
conda deactivate
elif [ "$CURRENT_CONDA_ENV" != "None" ]; then
echo "Detected an active conda environment '$CURRENT_CONDA_ENV'. This will be deactivated and the '$FLEPI_CONDA' environment wil be activated."
conda deactivate
fi
conda activate $FLEPI_CONDA

# Check the conda environment is valid
Expand Down

0 comments on commit b07b9f6

Please sign in to comment.