Anaconda python on hail in 2020

Overview of changes

Anaconda (conda) has grown from its linux-centric collection of shell scripts into a multi-platform package manager. source activate is out. conda commands are the new way. Please switch to the new way by running though these instructions.

Initialization and configuration of conda

First we want to have the conda command available when we log in:

/home/conda/bin/conda init bash

This adds a few lines to your ~/.bashrc file. It also checks for the existence of and creates if necessary the file ~/.condarc and the folder ~/.conda to hold your local envs. The next time you log in, the conda base env will be loaded. If you’d rather not have the base env loaded every time you log in, you can modify this with:

conda config --set auto_activate_base False

The conda command will still be available for use, but no envs will be active. As part of our multi-user installation, please run the following to prevent package cache collisions.

conda config --append pkgs_dirs "/home/${USER}/.conda/pkgs"

Many of you will be using the conda-forge channel. It may be easier if you set that priority now, before you start building. Mixing of channels can send you into dependency hell.

conda config --prepend channels conda-forge

Activation of envs

After logging out and back in. Everything should be ready for you to conda all your old envs. To activate an env,

conda activate my_env

if no env is supplied, it will activate the base environment.

Creation

env creation is pretty much the same. Here we create and activate an env named my_env.

conda create --name my_env conda activate my_env

add some packages

conda install xarray jupyter matplotlib pynio

When things go wrong

You can always start over. To nuke an env you’ve destroyed:

conda env remove --name my_env

You can also remove and reinstall packages in the active env, for example:

conda remove matplotlib conda install --channel conda-forge matplotlib

The user guide is here https://docs.conda.io/projects/conda/en/latest/user-guide/index.html

Run jupyter remotely

Step 1: On your local machine terminal

ssh username@hail.met.fsu.edu -XY -A -L 55441:localhost:55441

Step 2: On hail make sure you have jupyter lab itself installed (conda install jupyterlab) and then type the following

conda activate awing jupyter lab --no-browser --port=55441 jupyter lab --no-browser --ip=127.0.0.1 --port=55441

As you are probably familiar with, your terminal will display a bunch of stuff, just set it aside so you don't exit out of it.

Step 3: On your local machine, in an internt browser (firefox, chrome, safari) go to

http://localhost:55441/

or you can click on the link at the bottom of what it spits out and it will open in a new browser window. You'll have to log in to jupyter. You can set a jupyter password with

jupyter notebook password

on hail in the activated environment with jupyter lab downloaded. Localhost 55441, 55442, and 55443 work on hail. Step 4: To quit jupyter, on your local machine exit out of the tab your notebook is open on

ctrl+c

and then

y

to exit out of the notebook and return to the normal shell.

Acknowledgements

Thank you to Kelly Hirai and Catherine Stauffer for putting together this guide.


This document was translated from LATEX by HEVEA.