From 8ce106f8a5a70c44c11497dc6add1f772fe27eef Mon Sep 17 00:00:00 2001
From: Michael <m.langguth@fz-juelich.de>
Date: Mon, 28 Feb 2022 15:18:50 +0100
Subject: [PATCH] Adapt install_venv_container.sh to detect used Python-version
 automatically and adapt requirements_nocontainer.sh to allow for usage on
 other HPC-systems.

---
 video_prediction_tools/env_setup/install_venv_container.sh | 7 +++++--
 .../env_setup/requirements_nocontainer.txt                 | 6 ++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/video_prediction_tools/env_setup/install_venv_container.sh b/video_prediction_tools/env_setup/install_venv_container.sh
index 3e5c35b9..e6444cc3 100755
--- a/video_prediction_tools/env_setup/install_venv_container.sh
+++ b/video_prediction_tools/env_setup/install_venv_container.sh
@@ -41,6 +41,9 @@ if [ ! -f "${VENV_REQ}" ]; then
   return
 fi
 
+# get Python-version
+PYTHON_VERSION=$(python3 -c 'import sys; version=sys.version_info[:2]; print("{0}.{1}".format(*version))')
+
 # create or change to  base directory for virtual environment (i.e. where the virtualenv-module is placed)
 if ! [[ -d "${VENV_BASE}" ]]; then
   mkdir "${VENV_BASE}"
@@ -67,8 +70,8 @@ echo "Actiavting virtual environment ${VENV_NAME} to install required Python mod
 ACT_VENV="${VENV_DIR}/bin/activate"
 source "${VENV_DIR}/bin/activate"
 # set PYTHONPATH...
-export PYTHONPATH=/usr/local/lib/python3.8/dist-packages/:$PYTHONPATH
-export PYTHONPATH=${WORKING_DIR}/virtual_envs/${VENV_NAME}/lib/python3.8/site-packages:$PYTHONPATH
+export PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/dist-packages/:$PYTHONPATH
+export PYTHONPATH=${WORKING_DIR}/virtual_envs/${VENV_NAME}/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
 export PYTHONPATH=${WORKING_DIR}:$PYTHONPATH
 export PYTHONPATH=${WORKING_DIR}/utils:$PYTHONPATH
 export PYTHONPATH=${WORKING_DIR}/model_modules:$PYTHONPATH
diff --git a/video_prediction_tools/env_setup/requirements_nocontainer.txt b/video_prediction_tools/env_setup/requirements_nocontainer.txt
index d72e87b4..0bd16aae 100755
--- a/video_prediction_tools/env_setup/requirements_nocontainer.txt
+++ b/video_prediction_tools/env_setup/requirements_nocontainer.txt
@@ -3,14 +3,12 @@ mpi4py==3.0.1
 pandas==0.25.3
 xarray==0.16.0
 basemap==1.3.0
-imageio==2.15.0     # although this numpy-version is in the container, we set it here to avoid any further installation
+imageio==2.15.0
 numpy==1.17.3
-scikit-image==0.17.2
-#scikit-image==0.18.1
+scikit-image==0.18.1
 opencv-python-headless==4.2.0.34
 netcdf4==1.5.8
 #metadata==0.2
 normalization==0.4
 utils==1.0.1
-tensorflow==1.13.1
 
-- 
GitLab