Python

Last modified:September 25, 2019

The following documentation applies to python3 environnment on CentOS7 (via X2Go).

modules

If you want a python3 module that isn’t installed, run the following command to see if it’s available via the package manager:

yum list available python3*

If it’s available, email support@cirl.berkeley.edu to request installation.

If the module isn’t available via yum, or you just want to install the module yourself, then use pip or setup.py (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

Improve performance of Jupyter Notebook by using the web browser on your desktop or laptop. Below are instructions to start a notebook in your NoMachine or X2Go remote desktop session:

  1. Enable 2-step authentication if you haven’t done so already.

  2. In your X2Go session, start jupyter notebook with the following options (replace ‘9999‘ with any number between 1024 and 32768):

    [joe@nx2 ~]$ jupyter notebook --port 9999 --no-browser --ip=*
  3. On your desktop (or laptop) computer, open a terminal window. Then run the following command (using the appropriate options):

    [joe@desktop:~]$ ssh -L 9999:localhost:9999 joe@nx2.neuro.berkeley.edu
    • replace ‘9999‘ with the port number you specified above with the –port option
    • repace ‘nx2‘ with the hostname where you started the jupyter notebook
    • replace ‘joe‘ with your username on the cluster
  4. Enter your password and 2-step verification code.

  5. copy the URL displayed in the output of step #1, and copy it to your desktop web browser. It will look something like:

    http://localhost:9999/?token=580asdfad4bfd0csdf846dsdflll20a13025dc906f6a2c62