-
Notifications
You must be signed in to change notification settings - Fork 5
Farm customization
Or how to install a program, make it a module, create a virtual environment, and use them together in a script. Using miniconda3 and SMC++ as an example. (SMC++ has disappeared from farm's miniconda3 -AKA conda3/bio3- install more than once and a reliable installation was needed.) Disclaimer: Works as intended but may not be the best method
First, get the Miniconda3 install file
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
Install to your chosen directory
bash ./Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/Software/miniconda3
- (flags:
-bforced unattended installation;-pindicates the installation path) - Note: Also see the more comprehensive information about software installation on farm
Create your personal modules directory
mkdir -p $HOME/MyModules/miniconda3
-
Note: miniconda3 was not a module listed in
module availfor the cluster therefore it was okay to use, however, I think you can name the module whatever you want.
Copy the module file for miniconda (i.e. conda3) to your personal modules directory
cp /share/apps/modulefiles/hpc/conda3/1.0 $HOME/MyModules/miniconda3
Modify the setenv in $HOME/MyModules/miniconda3/1.0 to the user installation
-
Original:
setenv CONDA3_HOME /share/apps/conda3/miniconda3 -
Modified:
setenv MINICONDA3_HOME /<full path to program here>/miniconda3 -
Note: modified CONDA3_HOME throughout 1.0 file to MINICONDA3_HOME to ensure proper functioning
Add to your available modules
module use $HOME/MyModules
-
Note:
module availwill now show your personal modules under the first section listed, in my case/home/dmvelasc/MyModules -
Note:
module use $HOME/MyModulesandexport MODULEPATH=$HOME/MyModules:$MODULEPATHonly temporarily save$HOME/MyModulesin the$MODULEPATH.
Load your miniconda module
module load miniconda3
-
Note: Be sure to add your module to the module list with
module use $HOME/MyModulesbefore calling it
Create a virtual environments directory
mkdir $HOME/.virtualenvs
Create the desired virtual environment
virtualenv -p python3 .virtualenvs/smcpp
-
Note: the
-pflag specifies the python version to use, can be even more version-specific if that version is installed
Activate the virtual environment
source $HOME/.virtualenvs/smcpp/bin/activate
Install SMC++
conda install -c terhorst -c bioconda smcpp
- Note: DO NOT DO THIS ON THE HEAD NODE use an interactive session
USE YOUR NEW MODULE AND VIRTUAL ENVIRONMENT IN A SCRIPT
You will need to include the following lines, with full paths, in your script after the header, etc.
module use /<full path>/MyModules
module load miniconda3
set +u
source <full path>/.virtualenvs/smcpp/bin/activate
set -u
-
Note: the
set +uandset -uare workarounds to an unbound variable problem in the activate script when usingset -uin the bash script
Then carry on as normal in your script with bash and SMC++ commands
Helpful resources used to put this together
- University of Utah Center for High Performance Computing User Installed Python and Advanced Modules Tutorial
- The University of Chicago Research Computing Center Tips and Tricks
- freeCodeCamp Why you need Python environments and how to manage them with Conda
- HiPer Gator Research Computing Personal Python Module Installation and Modules
- Torrant's Tech Blog Using Pythong Virtual Environments with Slurm
RILab Wiki
Farm Subwiki
- Farm Information
- How to Use
- Account Set Up
- Data Transfer
- Interactive Use
- Software Installation
- Customization
- Productivity Tips
- Other Tips and Tricks
- Emailing Help
Other Computing Information
Maize
Protocols