This gist describes how to clone the SSSC conda
environment (and jupyter
kernel) on epyc
into your own directory where you can install your own packages into.
This will continue using the LSST stack from the SSSC directory, but you will be able to override (i.e., setup
, in the EUPS sense) individual packages by editing your copy of env-setup.sh
(see below).
##
## make sure you're using bash, and bring conda to your path
##
bash
. /epyc/opt/anaconda/etc/profile.d/conda.sh
export SSSC="/epyc/projects/sssc"
##
## Create a directory for the new environment and files
##
export DIR="/epyc/ssd/users/$USER/sssc"
mkdir -p "$DIR"
cd "$DIR"
##
## Clone the SSSC conda environment
##
export ENVDIR="$DIR/conda-sssc-env"
conda create -p "$ENVDIR" --clone "$SSSC/conda-sssc-env/"
conda activate "$ENVDIR"
##
## Copy and tweak the Jupyter kernel support files
##
cp "$SSSC/sssc-jupyterhub/ipykernel-with-lsst-stack.sh" "$DIR"
cp "$SSSC/sssc-jupyterhub/env-setup.sh" "$DIR"
sed -i "s|activate /epyc/projects/sssc/conda-sssc-env|activate $ENVDIR|" "$DIR/env-setup.sh"
##
## Copy and tweak the Jupyter kernel definition file
##
mkdir -p $HOME/.local/share/jupyter/kernels
export IPY="$HOME/.local/share/jupyter/kernels/sssc-$USER"
cp -a "$SSSC/sssc-jupyterhub/kernels/python3" "$IPY"
# This will change the startup command to our own
sed -i 's|[^"]*/\(ipykernel-with-lsst-stack.sh\)|'"$DIR"'/\1|' "$IPY/kernel.json"
# This will change the kernel display name
sed -i 's|display_name":.*|display_name": "Python 3 (my SSSC)",|' "$IPY/kernel.json"
Now refresh your JupyterHub page, and you should see the new kernel named Python 3 (my SSSC)
available.
To install new packages into your cloned environment, open a terminal and run:
bash # only needed if it's not your default shell
. /epyc/opt/anaconda/etc/profile.d/conda.sh
conda activate /epyc/ssd/users/$USER/sssc/conda-sssc-env
conda install YOUR_PACKAGE_OF_INTEREST