Skip to content

Instantly share code, notes, and snippets.

@jerowe
Last active March 18, 2020 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerowe/59e8ebb86e0902101a0e2e08378c1006 to your computer and use it in GitHub Desktop.
Save jerowe/59e8ebb86e0902101a0e2e08378c1006 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
### EasyBuild Installation and Module Deployment
##################################################################
## Make lmod available
##################################################################
source /usr/share/lmod/lmod/init/bash
###################################################################
### Deploy modules - Environmental Variables
export EASYBUILD_PREFIX=/apps/easybuild/1.0
export MODULEPATH=/apps/easybuild/1.0/modules/all
export ROBOT=/app/software-configs
export ANACONDA3_BASE="$HOME/.local/anaconda3"
export EB_ENV=eb-4.0.0
export PATH=${ANACONDA3_BASE}/bin:$PATH
export PATH="${ANACONDA3_BASE}/envs/${EB_ENV}/bin/:$PATH"
function install_miniconda {
curl -s -L https://repo.continuum.io/miniconda/Miniconda3-py38_4.8.2-Linux-x86_64.sh > miniconda.sh
chmod 777 miniconda.sh ; bash miniconda.sh -f -b -p $ANACONDA3_BASE
rm miniconda.sh && \
export PATH=${ANACONDA3_BASE}/bin:$PATH && \
conda config --set show_channel_urls True && \
conda config --add channels conda-forge && \
conda config --add channels bioconda && \
conda config --set always_yes True && \
conda update --all --yes && \
conda config --set allow_softlinks False && \
conda clean -tipy
}
function install_easybuild {
##################################################################
## Add Easybuild Config
## This is just a placeholder, but needed for some setups
##################################################################
mkdir -p $HOME/.config/easybuild
##################################################################
## Install Easybuild and Lmod
## Create a conda env with easybuild
## Then update the easybuild env with pip to get the 4.0.0 version
##################################################################
FILE="eb-env-${EB_ENV}.yml"
cat <<EOM >$FILE
# Install easybuild from an env file
name: ${EB_ENV}
channels:
- conda-forge
- defaults
dependencies:
- python=2.7
- jinja2
- pip
- anaconda-client
- pip: # Packages installed from PyPI
- easybuild==4.0.0
EOM
conda env create -f $FILE
T_PWD=$PWD
cd /tmp
wget https://raw.githubusercontent.com/jerowe/easybuild-easyblocks/develop/easybuild/easyblocks/generic/conda.py
find ${ANACONDA3_BASE}/envs/${EB_ENV} -type f -name conda.py | grep generic | xargs -I {} mv /tmp/conda.py {}
cd $T_PWD
##################################################################
## Install an Easybuild Config
## Miniconda3 is a Core EB config
## --software-name is a way of telling EB to look for software
## from the repos instead of supplying a .eb file
##################################################################
# This times out if it's done from the initialization script
# Just run it manually
source activate $EB_ENV && \
eb --software-name Miniconda3
}
##################################################################
## Anaconda Setup
## We are using miniconda3/python3 from anaconda
## Be sure to change this if you are running as a your own user
##################################################################
if [ ! -d "${ANACONDA3_BASE}" ]; then
echo "No anaconda3 found. Installing..."
install_miniconda
else
echo "Anaconda3 installation already present. Exiting."
fi
if [ ! -d "${ANACONDA3_BASE}/envs/${EB_ENV}" ]; then
echo "No easybuild found. Installing..."
install_easybuild
else
echo "EasyBuild installation already present. Exiting."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment