User Tools

Site Tools


other:uvcdat:cdat_conda:ipnb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
other:uvcdat:cdat_conda:ipnb [2019/05/16 08:52]
jypeter Updated
other:uvcdat:cdat_conda:ipnb [2019/05/20 09:10] (current)
jypeter Improved
Line 4: Line 4:
  
 There are **many** python distributions,​ **many** python versions (''​2.7.xx'',​ ''​3.nn''​) and... **many** ways to use python: There are **many** python distributions,​ **many** python versions (''​2.7.xx'',​ ''​3.nn''​) and... **many** ways to use python:
-  * //​interactively//​ or by running a //script// (or running a script and then typing interactive commands)+  * //​interactively//​ or by running a //script// (or running a script ​with ''​python -i script.py'' ​and then typing interactive commands)
   * using python in a //Linux terminal//, the [[https://​www.spyder-ide.org/​|Spyder]] GUI (Graphical User Interface) a //Windows// //cmd// terminal or powershell, a //Mac// terminal, or whatever GUI the distribution you have installed on Windows or Mac provides   * using python in a //Linux terminal//, the [[https://​www.spyder-ide.org/​|Spyder]] GUI (Graphical User Interface) a //Windows// //cmd// terminal or powershell, a //Mac// terminal, or whatever GUI the distribution you have installed on Windows or Mac provides
   * using the default ''​python''​ interpreter or the ''​ipython''​ interpreter \\ <​code>​ > python   * using the default ''​python''​ interpreter or the ''​ipython''​ interpreter \\ <​code>​ > python
Line 24: Line 24:
 In [2]: In [2]:
 Do you really want to exit ([y]/n)? y</​code>​ Do you really want to exit ([y]/n)? y</​code>​
-  * using //ipython notebooks// +  * using python interactively in a //ipython notebooks//, which means that 
- +    * you will use an ipython interpreter 
-//Using an ipython notebook// ​means that: +    * in a web browser (rather than a terminal) 
-  * you will use an ipython interpreter +    * a notebook is the content of the web page where you have interacted with python. You can save it (''​.ppynb''​ file) and share it, and it will display both the commands you have used and the output/​results of your commands 
-  * in a web browser (rather than a terminal) +    * the notebooks have cells with python input, python output (including graphics), and cells that can be used to format the document (titles, formatted text, equations, images, etc...) 
-  * a notebook is the content of the web page where you have interacted with python. You can save it (''​.ppynb''​ file) and share it, and it will display both the commands you have used and the output/​results of your command+    * the notebooks support several other languages (e.g. **R**)
  
 ===== How does it work? ===== ===== How does it work? =====
Line 43: Line 43:
       * the server will display the URL that you have to use. The URL has an authentication token and only you (or the person who has a copy of the full URL) can connect to your server       * the server will display the URL that you have to use. The URL has an authentication token and only you (or the person who has a copy of the full URL) can connect to your server
     * the basic way to start a server is to just  type ''​jupyter notebook'',​ but only do this if you want to work locally on your desktop/​laptop! See the next section for working on a remote computer     * the basic way to start a server is to just  type ''​jupyter notebook'',​ but only do this if you want to work locally on your desktop/​laptop! See the next section for working on a remote computer
-      * the ''​jupyter notebook''​ command will start the notebook server, and it will automatically start a web browser on the same computer. That's OK on your local computer, but on a remote server, the browser will probably seem to be slow (and out of date) and will use unnecessary resources of the server. This will be frustrating for you and the other users of the server +      * the ''​jupyter notebook''​ command will start the notebook server, and it will automatically start a web browser on the same computer. That's OK on your local computer, but on a remote server, the browser will probably seem to be slow (and probably ​out of date) and will use unnecessary resources of the server. This will be frustrating for you and the other users of the server 
-    * if you have to work on a remote computer, the idea is to start the ipython server on the remote computer and use a web browser on your local computer (thanks to an //ssh tunnel//)+    * if you have to work on a remote computer, ​<wrap hi>the idea is to start the ipython server on the remote computer and use a web browser on your local computer</​wrap> ​(thanks to an //ssh tunnel//)
   - in a web browser, open the temporary URL displayed by the ipython server and start using the ipython notebooks   - in a web browser, open the temporary URL displayed by the ipython server and start using the ipython notebooks
-  - when you are finished, <wrap em>do not forget to kill the ipython server</​wrap>​ by typing ''​^C^C''​ (2x ''​CTRL-C''​). Otherwise the server and the python processes started by the server will keep on using resources on the computer +  - when you are finished, <wrap em>do not forget to kill the ipython server</​wrap>​ by typing ''​^C^C''​ (2x ''​CTRL-C''​) ​in the terminal where you started the server. Otherwise the server and the python processes started by the server will keep on using resources on the computer 
-    * Warning! Closing the browser, or using the Logout button in the browser will not stop the ipython server+    * Warning! Closing the browser, or using the ''​Logout'' ​button in the browser will not stop the ipython server. You can stop the server by clicking on the ''​XXXX''​ FIXME button
  
 ===== Working correctly with the notebooks ===== ===== Working correctly with the notebooks =====
Line 55: Line 55:
   * Make sure you read and understand the [[#​how_does_it_work|How does it work?]] section above   * Make sure you read and understand the [[#​how_does_it_work|How does it work?]] section above
   * If you have a python installed **on your own desktop/​laptop**,​ you can just start a local notebook server and browser with\\ ''​jupyter notebook''​   * If you have a python installed **on your own desktop/​laptop**,​ you can just start a local notebook server and browser with\\ ''​jupyter notebook''​
-  * **On a remote and shared server**, only start the notebook server and use a local browser to connect to the notebook server through an ssh tunnel+  * **On a remote and shared server**, only start the notebook server and use a local browser to connect to the notebook server through an //ssh tunnel//.
  
 ==== Prerequisites ==== ==== Prerequisites ====
  
-  ​* We assume that you have a local web browser installed!\\ Depending ​on your (local) computer+You need to meet the following prerequisites in order to create an ssh tunnel to the remote server where your notebook server will run 
-    * **Linux**: you should already be able to open a local terminal, and ''​ssh''​ is installed by default + 
-    * **Windows ​7**: you need to know how to open a Windows ​prompt/​command-line ​(''​Windows''​+''​R'',​ then open ''​cmd''​and you need to install [[other:​win10apps#​putty_pageant|Putty]] in order to use ''​ssh'':​ +  ​* We assume that
-      * In the instructions below, replace ''​ssh''​ with ''​plink''​ if you are using Windows 7+    * **you have a local web browser** installed! 
 +    * **you have an account ​on the remote server**: replace ''<​LOGIN>''​ below with your account name 
 +    * **you have an assigned a //port number//** on the remote server: replace ''<​PPPP>''​ with your specific port number 
 +      * List of assigned port numbers at **LSCE**: check the [[http://​wiki.ipsl.jussieu.fr/​IGCMG/​Outils/​IPython_Notebook#​Shared_TCP_ports|Shared TCP ports]] table 
 +        * Ask your advisor for a port number at LSCE if you do not have one 
 +      * List of assigned port numbers on **ciclad**: check the ''/​ciclad-home/​jservon/​Evaluation/​CliMAF/​climaf_installs/​climaf_1.2.10/​bin/​cmip6.notebook.txt''​ file 
 +        * Ask Jérôme Servonnat for a port number on ciclad if you do not have one 
 +  * System dependent requirements
 +    * **Linux** and **Mac**: you should already be able to open a local terminal, and ''​ssh''​ is installed by default 
 +    * **Windows**: ​you either need to have [[other:​win10apps#​putty_pageant|Putty]] installed, or you need to know how to open a Windows ​PowerShell ​(''​CTRL''​+''​Esc'' ​to open the start menu, then type ''​PowerShell''​ and start a PowerShell) 
 +      * **Windows 7**: you have to install [[other:​win10apps#​putty_pageant|Putty]] in order to use ''​ssh'':​ 
 +        * In the instructions below, replace ''​ssh''​ with ''​plink''​ if you are using Windows 7, because //plink// is the name of the Putty ssh command-line executable 
 +      * **Windows 10**: ssh is already installed, but you may still want to install [[other:​win10apps#​putty_pageant|Putty]] in order to use predefined sessions 
 +        * if you have installed [[https://​wiki.lsce.ipsl.fr/​pmip3/​doku.php/​other:​win10wsl|Windows Subsystem for Linux and Ubuntu]], you can also use a Ubuntu terminal
  
 ==== Digging ssh tunnels ==== ==== Digging ssh tunnels ====
  
-The ssh tunnels will allow you to connect a web browser running locally on your computer to a notebook server running on a remote server+The ssh tunnels will allow you to connect a web browser running ​**locally** on your computer to a notebook server running on a **remote** server
  
 === From a local LSCE computer to obelix === === From a local LSCE computer to obelix ===
 +
 +ssh -L 7225:​localhost:​7225 jypeter@obelix
 +
 +=== From a computer outside LSCE to obelix ===
 +
 +In that case, we have to go through the ssh1 gateway before connecting to obelix
  
 <​code>​plink -L 7225:​localhost:​7225 jypeter@obelix <​code>​plink -L 7225:​localhost:​7225 jypeter@obelix
Line 98: Line 117:
     Or copy and paste one of these URLs:     Or copy and paste one of these URLs:
         http://​localhost:​7100/?​token=256f8fa26c8478f136720e0c0c24c4995b6682d9febf6387</​code>​         http://​localhost:​7100/?​token=256f8fa26c8478f136720e0c0c24c4995b6682d9febf6387</​code>​
 +
 +==== Extra resources ====
 +
 +  * Jérôme'​s script for starting notebooks on the ciclad cluster: ''/​ciclad-home/​jservon/​Evaluation/​CliMAF/​climaf_installs/​climaf_1.2.10/​bin/​climaf-notebook''​
 +  * [[http://​wiki.ipsl.jussieu.fr/​IGCMG/​Outils/​IPython_Notebook|Patrick'​s page 1]]
 +  * [[https://​nbviewer.jupyter.org/​github/​PBrockmann/​IPy_Notebooks/​blob/​master/​introduction/​Presentation_01.ipynb|Patricks'​ page 2]]
 +  * JYP's [[https://​wiki.lsce.ipsl.fr/​pmip3/​doku.php/​other:​uvcdat:​cdat_conda:​climaf_test|Testing CLIMAF on ciclad]] page
  
 /* standard page footer */ /* standard page footer */
other/uvcdat/cdat_conda/ipnb.1557996743.txt.gz · Last modified: 2019/05/16 08:52 by jypeter