#!/bin/bash
# __author__ = Felix Kleinert
# __date__  = '2020-04-06'

# This script creates a virtual env which contains all modules which are not available via slrum/easybuild (see mlt_modules.sh)

# $1 has to be an abs path to HPC_setup. If not provided, $PWD is used

# enter setting dir if called externally
if [[ $1 != '' ]]; then
  cur=$1
else
  cur=$PWD
fi

# load existing modules
source ${cur}mlt_modules_juwels.sh

# create venv 
python3 -m venv ${cur}/../venv_juwels

source ${cur}/../venv_juwels/bin/activate

# export path for side-packages 
export PYTHONPATH=${cur}/../venv_juwels/lib/python3.6/site-packages:${PYTHONPATH}


echo "##### START INSTALLING requirements_JUWELS_additionals.txt #####"
pip install -r ${cur}/requirements_JUWELS_additionals.txt
echo "##### FINISH INSTALLING requirements_JUWELS_additionals.txt #####"

pip install -r ${cur}/requirements_JUWELS_additionals.txt
pip install netcdf4
pip install --ignore-installed matplotlib==3.2.0
pip install --ignore-installed pandas==1.0.1
pip install -U typing_extensions

# Comment: Maybe we have to export PYTHONPATH a second time ater activating the venv (after job allocation)