Jupyter

From SGEES Wiki
Jump to navigation Jump to search

Web interface for Python

There are several instances of Python web IDE's running at our high performance clusters

Jupyter Hub (Jupyter Lab) Instances

Shared Notebooks

If you need to expose your notebook to other users, they can do it with symbolic links. Assume your user name is alice and you want to share (in read-only mode) data located in ~/Documents/jupyter/shared to user bob

  • Check permissions of directory and files (755, 644)
  • Ask Bob to create symbolic link from your directory - some like:

mkdir ~/Documents/alice

ln -s /Users/home/alice/Documents/jupyter/shared/ /Users/home/bob/Documents/alice/

Jupyter Notebook

This host name is just a proxy to localhost at sgees018, and you might need it if you want to share a custom instance of Jupyter (e.g. would like to share your personal virtual environment).

Please be aware you're exposing your home directory to users who has obtained either token or password.

There only one copy of Jupyter notebook can run on the server, so check before if nobody else has it running at the moment.

There are two common ways to start jupyter notebook.

At first, log in to sgees018.geo.vuw.ac.nz via SSH, then choose one of the following


Auto Configuration with Token Access
  • Start Jupyter with auto configuration, i.e. jupyter notebook and copy generated session link from terminal output, it will look like:

http://localhost:8888/?token=a15bf9fdf6aae1108bd889d69bb60638f97d6d129f8f1ba1

  • Change localhost:8888 to external host name jupyter.geo.vuw.ac.nz :

http://jupyter.geo.vuw.ac.nz/?token=a15bf9fdf6aae1108bd889d69bb60638f97d6d129f8f1ba1

  • Use modified link to access the notebook from VUW network.


Permanent Configuration with Password Access
  • Run once jupyter notebook --generate-config
  • Generate password hash - start Python interpreter (python or ipython) and run the following code:

from notebook.auth import passwd
passwd()
Enter password: <Pick Up a password for notebook>
Verify password: <Retype it for confirmation>
Out[2]: 'sha1:c0dd1c6325a3:238f473a52c6a8542b962f9bb2128aebbe351e2d'

  • Copy SHA1 hash of your password - you'll need it later to put into configuration file
  • Edit ~/.jupiter/jupyter_notebook_config.py , find and change the following variables:

c.NotebookApp.custom_display_url = u'http://jupyter.geo.vuw.ac.nz'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:c0dd1c6325a3:238f473a52c6a8542b962f9bb2128aebbe351e2d'
c.NotebookApp.password_required = True

  • Start Jupyter: jupyter notebook