Setup to install python / jupyter on BC4

Add this to .bashrc:

module load lang/python/anaconda/3.7.7-2020-R-3.6.1
cd /user/work/hb18661 #ADJUST USER NAME
conda activate py37 #This needs to be added at the end of .bashrc

In the console, run the following commands

source .bashrc
conda init bash
jupyter notebook password

Run jupyter notebook from the login node (not suitable for large calculations)

Content of jupyter.sh file:

echo “jupyter is running on “$(hostname -i)
jupyter notebook –no-browser –ip=$(hostname -i) –port=XXXXXX

Please adjust port number (XXXXXX). I use my birthday e.g. 230289, please use a different number. Once jupyter is running, access the notebook using: localhost:51602 – or other source port as defined below – in a browser.

Run in putty:

bash jupyter.sh

You need to define a new port for each IP address in putty. See example snapshot:

Run jupyter notebook from a computation node (suitable for large calculations)

Submit new job, you need to open up a new port in Putty (as described above). The IP address of the new job is stored in IP_jupyter.IP.

sbatch slurm_jupyter.sh

Content of slurm_jupyter.sh (adjust username and port number):

#!/bin/bash
#SBATCH –partition short
#SBATCH –mem=1GB
#SBATCH –ntasks-per-node=1
#SBATCH –time=3-00:00:00
#SBATCH –nodes=1
#SBATCH –job-name=Jupyter
#SBATCH –output=output_jupyter

cd /user/home/hb18661/
source .bashrc
pwd
cd /user/work/hb18661/
pwd

echo “jupyter is running on “$(hostname -i) > IP_jupyter.IP
jupyter notebook –no-browser –ip=$(hostname -i) –port=XXXXXX

Packages that I typically need:

conda install -c ambermd pytraj