From 0ad73f50d643145436c835b2daeab2a4f0abe533 Mon Sep 17 00:00:00 2001 From: Wirawan Purwanto Date: Tue, 22 Feb 2022 10:41:11 -0500 Subject: [PATCH] * Saved README.txt of the lmod_python fix (notes written to Minhao, 2020-06-09). --- lmod/ipython/startup/README.txt | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 lmod/ipython/startup/README.txt diff --git a/lmod/ipython/startup/README.txt b/lmod/ipython/startup/README.txt new file mode 100644 index 0000000..221d414 --- /dev/null +++ b/lmod/ipython/startup/README.txt @@ -0,0 +1,43 @@ +Date: 2020-06-09 + +Purpose: troubleshoot & fix the ipython startup file +which caused issue. + +The original setup (combined `000-odurc-lmod.py` and `lmod_python.py`) +have several issues: + +* On Turing (vanilla ipython), could not find the module command. + +* On Wahab (vanilla ipython), invoking the "module" command resulted + in an error due to unset `LMOD_MANUAL_LD_LIBRARY_PATH` env var. + +* On Wahab/OOD, the "module" command messed up all the symlinks in the + specially prepared library dir (LMOD_MANUAL_LD_LIBRARY_PATH). + As a result, all symlinks become circular links. + +I fixed these files with the following improvements: + +1) Allow the setup to work on both Wahab and Turing. (The new + `lmod_python.py` needs to be installed somewhere on Turing; + I made up the location to be + `/cm/shared/applications/lmod/lmod/scripts/init`. + +2) Fix the indefinite lengthening of `sys.path` as a result of + "module" command invocation: now only the *changes* are updated + onto `sys.path`. Still not perfect (see notes in the Python code) + but should work ok for most cases. + +3) As a result of fix #2 above, when we invoke `module("unload", + A_MODULE)`, the paths associated with `A_MODULE` will also be removed. + +4) Fix the "circular links" problem. If `LMOD_MANUAL_LD_LIBRARY_PATH` + is not specified, it quietly ignores the symlink update process. + +See if you like these changes---I suggest implementing them soon. + +I found that the existing `000-odurc-lmod.py` is always overwritten +whenever I launch Jupyter on Wahab OOD. It was due to `before.sh` of +the OOD Jupyter notebook setup ... grrr. I know you assume that users +won't mess with this file (but I did, while doing all this testing). +I'll make my own workaround. +