mdsplus icon indicating copy to clipboard operation
mdsplus copied to clipboard

enable linking MDSplus to custom python conda environments, and NOT system-wide python

Open vadim-at-te opened this issue 1 year ago • 1 comments

Affiliation Tokamak Energy, 173 Brook Dr, Milton, Abingdon, UK

Description MDSplus installation is hard-coded to use system-wide python installation. This is creates problems especially in the context of supporting custom-written TDI-functions which tend to be written in python. The python version requirements constantly evolve, yet, under current MDSplus setup the only way to update the python version used to execute python TDI function is to update system-wide python on the server. However, on Red Hat and similar systems, system-wide python is used for operating system internal functionality, such as by yum package manager. So it's an actual real-life example that yum package manager python requirements and a TDI python function requirements are mutually exclusive.

I managed to implement a hack work-around that seems to sort of function, provided in the example below. It at least doesn't break yum package manager, and the TDI functions' requirements are installed in "ops_env_nonDocker" conda environment, and so that works.

Example

[vadim.nemytov@newsmaug ~]$ cat /usr/local/mdsplus/setup.sh
...
if [ -z "$PyLib" ]
then
  #pyver="$(python -V 2>&1)"
  pyver="$(/home/pcs.user/anaconda3/envs/ops_env_nonDocker/bin/python -V 2>&1)"

  if [ $? = 0 -a "$pyver" != "" ]
  then
    #PyLib=$(echo $pyver | awk '{print $2}' 2>/dev/null | awk -F. '{print "python"$1"."$2}' 2>/dev/null)
    PyLib=/home/pcs.user/anaconda3/envs/ops_env_nonDocker/lib/libpython3.6m.so
    if [ $? = 0 ]
    then
      doExport PyLib
    fi
  fi
fi
...

Additional context Note that it is not yet possible and not yet recommended to install MDSplus inside Docker because, in part, of the issues of mapping client usernames onto linux docker-host-physical-server usernames and, hence, manage permissions to mdsplus tree files. It also doesn't seem particularly easy to set up the docker mdsplus installation b/c distinct MDSplus servers (mdsip, other servers) are lumped together and don't have a clear boundary / interface.

If the docker MDSplus set up was mature that could potentially offer a solution to managing python environment used by MDSplus as well as other problems.

vadim-at-te avatar Jun 12 '24 09:06 vadim-at-te