Python¶
Anaconda3 Python is available in /usr/local/anaconda3/bin.
Conda¶
Note
Anaconda is disabled by default. Otherwise, Anaconda libraries interfere with the operating system network utilities.
When you want Anaconda, run conda activate <env_name> in your terminal. Instructions are below.
To list environments:
conda env list
To create an environment:
conda create --name <env_name>
Replace <env_name> with the name of your environment. No packages will be installed in this environment. Confirm the env location with ‘conda env list’.
To create an environment with a specific package:
conda create -n <env_name> scipy
which can also be accomplished using:
conda create -n <env_name> python conda install -n <env_name> scipy
To activate a conda environment:
conda activate <env_name>
To leave your conda environment:
conda deactivate
More information about managing environments is here:
https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
packages¶
list packages installed in a specific environment:
conda list -n <env_name>
Install a package from the ‘defaults’ channel:
conda install -n <env_name> scipi
More information about managing packages is here:
https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-pkgs.html
Conda integration with Slurm (batch processing)¶
By default, Slurm doesn’t initialize conda environments from a user’s .bashrc file.
To initialize conda, add the following line to your slurm submit script:
eval "$(/usr/local/anaconda3/bin/conda shell.bash hook)"
conda activate <env_name>
Jupyter Notebook¶
You may run jupyter notebook/lab anywhere on the neuro cluster, and view it on your local desktop.
Log in via SSH, or remote desktop
If you logged in via remote desktop, then open a terminal window
From your terminal on the neuro cluster, run ‘jupyter notebook’ with the ‘–no-browser’ option:
jupyter notebook --no-browser
You will see output similar to the following:
Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://localhost:8780/?token=76e3a90efd4159sdfllfaa73e6f8sdf2b6dsdf3cddbc742f
On your Mac, open a terminal window, and use the ssh command to create a tunnel:
ssh -L <port>:localhost:<port> <username>@<servername>neuro.berkeley.edu
where…the port number was automatically assigned in step #2, shown after the word ‘localhost:’. In this example, the port number is 8780.username is your neuro cluster user nameservername is the neuro cluster server from in step #1 (where you ran the jupyter command).For example:
ssh -L 8780:localhost:8780 user@axon.neuro.berkeley.edu
Copy and paste the URL displayed above (in step #2) into your web browser’s address bar on your desktop.