Skip to content

Anaconda_Multi_Users

Charles Doutriaux edited this page Mar 28, 2018 · 4 revisions

Using UV-CDAT/Anaconda on a multi user machine

More details about UV-CDAT and Anaconda can be found here

In this page it is assumed anaconda is installed in /usr/local/anaconda2

First of all you will need to make sure anaconda is in your PATH bash

export PATH=/usr/local/anaconda2/bin:${PATH}

or tcsh

setenv PATH /usr/local/anaconda2/bin:${PATH}

Second of all, conda uses the concept of environment which allows you to switch back and forth between various Python versions and Python configurations

To know the environments available to you do:

conda env list

to "activate" an environment simply type in BASH

source activate [ENV NAME]

latest will always point to the most recent version of uvcdat as before. But environments are refered to by date at which it was created.

unfortunately conda does not support tcsh so in order to activate an environment in [t]csh you will need to do:

setenv PATH /usr/local/anaconda2/envs/bin:${PATH}

But this will not deactivate environment(s) previously loaded and might lead to confusion (starting a new window is recommended)

We STRONGLY encourage you to switch to bash.

bash users can add the following to their .bashrc to help switching back and forth easily. Running setpy will automagically activate the latest conda env created

mostrecentdir() {
     echo $(basename `ls -lrtd /$1/*/ | awk '{print $9}' | tail -n1 `)
}
ANACONDA_HOME=/usr/local/anaconda2
# Newer setpy using anaconda envs
setpy() {
  if [ $# == 0 ]; then
    pth=$(mostrecentdir ${ANACONDA_HOME}/envs)
  else
    pth=$1
  fi
  echo "Using "${pth}" conda environment"
  source activate ${pth}
}

The beauty of anaconda is that it let you create and add environments at will, you can create your own environment with whatever python package you fancy using the following command

conda create -n [YOUR_ENV_NAME_HERE] cdat -c cdat/label/nightly -c conda-forge -c cdat [YOUR_DESIRED_ADDITIONAL_PACKAGES_HERE]
Clone this wiki locally