User Tools

Site Tools


other:uvcdat:cdat_conda:ipnb

This is an old revision of the document!


Working with ipython notebooks

What does this mean?

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)
  • using python in a Linux terminal, the 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
     > python
    Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38)
    [GCC 7.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> "python interpreter in a terminal".upper()
    'PYTHON INTERPRETER IN A TERMINAL'
    >>>
    
     > ipython
    Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38)
    Type 'copyright', 'credits' or 'license' for more information
    IPython 7.3.0 -- An enhanced Interactive Python. Type '?' for help.
    
    In [1]: "ipython interpreter in a terminal".upper()
    Out[1]: 'IPYTHON INTERPRETER IN A TERMINAL'
    
    In [2]:
    Do you really want to exit ([y]/n)? y
  • using ipython notebooks

Using an ipython notebook means that:

  • you will use an ipython interpreter
  • in a web browser (rather than a terminal)
  • 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

How does it work?

Using an ipython notebooks implies the following steps:

  1. determine if you will use python on your local computer or a remote computer and go to that computer
    • the selected computer mostly depends on the data you need to work with. The idea is to move the computation (i.e. python) near the data, and not move/replicate the data
  2. choose/initialize the distribution and version of python you need to use on the selected computer
  3. start the ipython notebook server with the appropriate parameters (on the selected computer, with the selected python)
    • this will start a temporary web server that you can connect to, in order to use the notebooks
      • 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 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
    • 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)
  4. in a web browser, open the temporary URL displayed by the ipython server and start using the ipython notebooks
  5. when you are finished, do not forget to kill the ipython server 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
    • Warning! Closing the browser, or using the Logout button in the browser will not stop the ipython server





[ PMIP3 Wiki Home ] - [ Help! ] - [ Wiki syntax ]

other/uvcdat/cdat_conda/ipnb.1557933196.txt.gz · Last modified: 2019/05/15 15:13 by jypeter