iPython Notebook
From the IPython Notebook webpage:
"The IPython Notebook is a web-based interactive computational environment where you can combine code execution, text, mathematics, plots and rich media into a single document."
For some neat examples of what Ipython can do, visit http://nbviewer.ipython.org/.
Instructions for setup:
Select a server from where you will execute the IPython Notebook.
Note that the Ipython Notebook only works withPython 2.7.3 installed at /uufs/chpc.utah.edu/sys/pkg/python/2.7.3
. For RHEL 6 systems the path is /uufs/chpc.utah.edu/sys/pkg/python/2.7.3_rhel6
.
We also assume that you use the BASH shell (mutatis mutandis for TCSH shell).
Setup:
Begin by logging into your hosting server and executing the following commands:
ssh -Y
$UNID@$server.chpc.utah.edu
source /uufs/chpc.utah.edu/sys/pkg/python/2.7.3/etc/python.sh
which python
ipython profile create $profile_name
ipython
In IPython execute the commands:
In [1]: from IPython.lib import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
In [3]: quit
The returned string 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed' is the password hash that you will need later on.
A subdirectory profile_$profile_name will be created in $HOME/.config/ipython (the default location) which contains among others the following files:
ipython_config.py
ipython_qtconsole_config.py
ipython_notebook_config.py
Note that the ipython profile path may be named differently (e.g. in case you already used ipython previously). In the subsequent files we have to edit the aforementioned file 'ipython_config.py'
Directly below the line
c = get_config()
add the following lines:
c.IPKernelApp.pylab = 'inline'
# the following tells ipython not to try to launch a browser on the remote host
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'<sha1 hash from above>'
# choose a port number between 10000 and 60000
c.NotebookApp.port = $port_number
Restrict the access to your config files that were just created
chmod -R go-rwx $HOME/.config/ipython
How to use the Notebook:
Log into $server.chpc.utah.edu using port tunneling:
ssh -L $port_number:127.0.0.1:$port_number $UNID@$server.chpc.utah.edu
Launch the ipython Notebook on $server
source /uufs/chpc.utah.edu/sys/pkg/python/2.7.3/etc/python.sh
ipython notebook --profile=$profile_name
Open a browser on your local machine and type in the following web address:
http://127.0.0.1:$port_number/
More info:
http://archive.ipython.org/media/PyCon2012-IPythonTutorial-Notebook.pdf