Python

Last modified:February 06, 2024

Anaconda Python is available in /usr/local.

modules

I recommend using pip to install additional python modules in your home directory. In the examples below, replace <module> with your module name:

pip:

pip install --user <module>

The package will be installed in $HOME/.local.

setup.py:

python setup.py install --prefix=$HOME/.local

Jupyter Notebook

performance

You can improve performance of jupyter notebook by accessing it directly from your Mac’s web browser (e.g. safari). Below are instructions:

  1. Start a X2Go remote desktop session. Note the server name that you logged into.

  2. In your X2Go session, open a terminal window, and 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:
    The number after the string ‘localhost:’ is called the port number. You will need this port number in the next step.
  3. On your Mac, open a terminal window, and run the ‘ssh’ command to create a tunnel from your Mac to your X2Go session. The syntax is:

    ssh -L <port>:localhost:<port> <username>@<servername>neuro.berkeley.edu

    For example, user ‘joe’ logged into nx66.neuro.berkeley.edu via X2Go. His jupyter notebook started on port number 8780, so he ran the following in his Mac terminal:

    ssh -L 8780:localhost:8780 joe@nx66.neuro.berkeley.edu

    The ssh command will prompt you for a password and for your 2-step verification code or ssh key passphase (if you configured a SSH key).

  4. Copy and paste the URL displayed above (in step #2) into the web browser on your Mac.