#!/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_hdfml.sh)
# enter setting dir if called externally

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

if [[ $1 != '' ]]; then
  cur=$1
else
  cur=$PWD
fi

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

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

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

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

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

# pip install --ignore-installed matplotlib==3.2.0
# pip install --ignore-installed pandas==1.0.1
# pip install --ignore-installed statsmodels==0.11.1
# pip install --ignore-installed tabulate
# pip install -U typing_extensions
# see wiki on hdfml for information oh h5py:
# https://gitlab.version.fz-juelich.de/haf/Wiki/-/wikis/HDF-ML%20System

export CC=mpicc
export HDF5_MPI="ON"
pip install --no-binary=h5py h5py
# pip install --ignore-installed netcdf4==1.5.4