IPython notebook: Difference between revisions

From IIHE Wiki
Jump to navigationJump to search
(Better ordering procedure)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
IPython is an interactive Python environment. Coupled with the "notebook" module, it provides a rich web interface.
IPython is an interactive Python environment. Coupled with the "notebook" module, it provides a rich web interface.
=Where is it=
IPython notebook is available on the cluster in 2 environments : the custom build and CVMFS.
To load from the custom build :
<pre>source /software/sources/latestEnvironment</pre>
To load from CVMFS :
See [[IceCube Software Cluster#CVMFS]]


=Launch a notebook=
=Launch a notebook=
When launching the notebook, the system will create a dedicated server listening to localhost (default) running on a specific port.
==Access from the outside==
To launch your notebook and access it from the outside (your browser) :
<pre>ipython notebook --ip=UI_URL --port=PORT_NUMBER --pylab inline</pre>
Where UI_URL is the ui url where you launched the command (eg. ui01.iihe.ac.be) and PORT_NUMBER is a custom defined port that you have to choose (between 1025 and 65635)
Then, open the url http://UI_URL:PORT_NUMBER from your web browser.
WARNING :
Using this method will expose your notebook to the outside (internet), that means if someone open your notebook, he can do whatever he wants on it. The safest way is to use a SSH tunnel.
==Access via SSH tunnel==
This way is more secure but a bit more complex
Launch the notebook only on localhost
<pre>ipython notebook --port=PORT_NUMBER --pylab inline</pre>
Create a tunnel from your machine
<pre>ssh -L PORT_NUMBER:localhost:PORT_NUMBER uixx.iihe.ac.be</pre>


Open the tunnelled notebook in your browser by opening the url : http://localhost:PORT_NUMBER
# Connect to the cluster.
# Load an environment :
#:IPython notebook is available on the cluster in 2 environments : the custom build and CVMFS.
#:* To load from the custom build [deprecated] :
#:*:<pre>source /software/sources/latestEnvironment.source</pre>
#:* To load from CVMFS :
#:*:See [[IceCube Software Cluster#CVMFS]]
# Launch a notebook to which you will later connect to from your laptop:
#:<pre>ipython notebook --no-browser --pylab inline</pre>
#:When launching the notebook, the system will create a dedicated server for you. It will be running on a specific port chosen by the notebook itself.
#:The launcher reports this port in the following way:
#:<pre>The IPython Notebook is running at: http://127.0.0.1:8888/</pre>
#:*The port number [PORT_NUMBER] you need is the number coming after the colon (:).
#:*The m-machine [M-MACHINE] is the machine where you launched the notebook.
# Open a new terminal on your laptop and create a tunnel to the machine where you instantiated the notebook. Fill in the correct port number in the following command:
#:<pre>ssh -L PORT_NUMBER:localhost:PORT_NUMBER M-MACHINE.iihe.ac.be</pre>
# The tunneled notebook is available in your browser by opening the url : http://localhost:PORT_NUMBER


=Links=
=Links=
http://ipython.org/
http://ipython.org/

Latest revision as of 13:32, 5 October 2016

IPython is an interactive Python environment. Coupled with the "notebook" module, it provides a rich web interface.

Launch a notebook

  1. Connect to the cluster.
  2. Load an environment :
    IPython notebook is available on the cluster in 2 environments : the custom build and CVMFS.
    • To load from the custom build [deprecated] :
      source /software/sources/latestEnvironment.source
    • To load from CVMFS :
      See IceCube Software Cluster#CVMFS
  3. Launch a notebook to which you will later connect to from your laptop:
    ipython notebook --no-browser --pylab inline
    When launching the notebook, the system will create a dedicated server for you. It will be running on a specific port chosen by the notebook itself.
    The launcher reports this port in the following way:
    The IPython Notebook is running at: http://127.0.0.1:8888/
    • The port number [PORT_NUMBER] you need is the number coming after the colon (:).
    • The m-machine [M-MACHINE] is the machine where you launched the notebook.
  4. Open a new terminal on your laptop and create a tunnel to the machine where you instantiated the notebook. Fill in the correct port number in the following command:
    ssh -L PORT_NUMBER:localhost:PORT_NUMBER M-MACHINE.iihe.ac.be
  5. The tunneled notebook is available in your browser by opening the url : http://localhost:PORT_NUMBER

Links

http://ipython.org/