From b1b34f40da7badcffb88418941637e15192f0e9a Mon Sep 17 00:00:00 2001
From: michael <m.langguth@fz-juelich.de>
Date: Mon, 28 Feb 2022 17:25:25 +0100
Subject: [PATCH] Ensure taht you are virtual environment when you are running
 without container.

---
 video_prediction_tools/env_setup/create_env.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/video_prediction_tools/env_setup/create_env.sh b/video_prediction_tools/env_setup/create_env.sh
index 127eb1af..fad6cf51 100755
--- a/video_prediction_tools/env_setup/create_env.sh
+++ b/video_prediction_tools/env_setup/create_env.sh
@@ -32,7 +32,7 @@ check_argin() {
     if [[ -z "${bool_container}" ]]; then
         bool_container=1
     fi
-    if [[ -z "${bool_container}" ]]; then
+    if [[ -z "${bool_hpc}" ]]; then
         bool_hpc=1
     fi
     # in case that no TF-container is set manually, set the default
@@ -69,6 +69,9 @@ WORKING_DIR="$(dirname "$THIS_DIR")"
 EXE_DIR="$(basename "$THIS_DIR")"
 ENV_DIR=${WORKING_DIR}/virtual_envs/${ENV_NAME}
 TF_CONTAINER=${WORKING_DIR}/HPC_scripts/${TF_CONTAINER_NAME}
+if [[ ${bool_hpc} == 0 ]]; then
+  TF_CONTAINER=${WORKING_DIR}/no_HPC_scripts/${TF_CONTAINER_NAME}
+fi 
 
 ## perform sanity checks
 
@@ -124,10 +127,14 @@ if [[ "$ENV_EXIST" == 0 ]]; then
     if [[ ${bool_hpc} == 1 ]]; then
       source ${THIS_DIR}/modules_train.sh
     fi
+    unset PYTHONPATH
     ./install_venv.sh "${ENV_DIR}"
 
+    # Activate virtual environment again
+    source "${ENV_DIR}/bin/activate"
+
     if [[ ${bool_hpc} == 0 ]]; then
-      pip install --no-cache-dir tensorflow==1.13.1
+      pip3 install --no-cache-dir tensorflow==1.13.1
     fi
   fi
 elif [[ "$ENV_EXIST" == 1 ]]; then
-- 
GitLab