The default python3 and root in cdms2 has files in /usr/local directory which doesn't let us install jupyter notebook and other python3 packages without sudo privileges. To install packages by our own needs, one alternative option is to install python3 and root locally first.
My working directory is /data/chocula/test_cdmsbats and the following commands are based on that.
-Make a /usr/local directory in the current working directory
mkdir /data/chocula/test_cdmsbats/usr mkdir /data/chocula/test_cdmsbats/usr/local
-Install Python3
wget https://www.python.org/ftp/python/3.7.13/Python-3.7.13.tgz tar xvf Python-3.7.13.tgz cd Python-3.7.13/ ./configure --prefix=/data/chocula/test_cdmsbats/usr/local --with-ensurepip=install make -j 8 make altinstall
Additional step to install numpy (needed to configure root in next step):
cd /data/chocula/test_cdmsbats/usr/local/bin/ ./python3.7 -m pip install numpy alias python3=/data/chocula/test_cdmsbats/usr/local/bin/python3.7
-Install ROOT (using root source from /data/chocula/neog/root folder)
mkdir root_build root_install && cd root_build cd /data/chocula/test_cdmsbats/root_build/ cmake3 -DPython3_EXECUTABLE=/data/chocula/test_cdmsbats/usr/local/bin/python3.7 -DCMAKE_INSTALL_PREFIX=../root_install /data/chocula/neog/root cmake3 --build . -- install -j4 source ../root_install/bin/thisroot.sh
-Make the /usr/local directory part of the system PATH variable
export PATH="/data/chocula/test_cdmsbats/usr/local/bin:$PATH"
-Install Jupyter
python3 -m pip install --upgrade pip python3 -m pip install jupyter
-Run jupyter to access it in your local browser
jupyter notebook --no-browser --port=8892
Copy the link from the terminal. Open another tab in your terminal and write
ssh -YL 8892:localhost:8892 neog0001@cdms2.spa.umn.edu
Open your browser and paste the copied link! (Use different port number if someone else is using this one)
-Make a setup file to load your settings
nano setup.sh
Paste the following lines of code in this file and save it
source /data/chocula/test_cdmsbats/root_install/bin/thisroot.sh alias python3=/data/chocula/test_cdmsbats/usr/local/bin/python3.7 export PATH=/data/chocula/test_cdmsbats/usr/local:$PATH alias jupyter=/data/chocula/test_cdmsbats/usr/local/bin/jupyter export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/chocula/test_cdmsbats/usr/local/lib
Source your setup.sh file
source setup.sh
-Suggested list of packages for analysis:
pandas, numpy, uproot, awkward, matplotlib, scipy
Singularity image as kernel
- Official CDMS singularity image [version: v04-12] is available here: /data/chocula/pandey/cdmsfull_V04-12-01.sif
- It has all the python libraries to run CDMS specific analysis.
- You can choose singularity container as a kernel on Jupyter notebook: simply go to Kernel → Change Kernel → V04-12