What is Jupyter?
Jupyter is an open source web application that makes it easy to create documents that combine live code, equations, visualizations, and text. Files created with Jupyter are called notebooks and have the extension .ipynb.
Once we log in to Jupyter through the cluster account, the server runs and the browser opens. At this point we are shown the so-called dashboard in which we will see that we are shown a list of the folders and files in the current directory.
You can choose to open a previous notebook that is displayed on the dashboard, upload notebooks from other directories to the dashboard, or create a new one. This is achieved through the buttons located at the top right. To upload notebooks from other directories to the dashboard we have the Upload button.
On the other hand, to create a new notebook you must access the New menu, from which you can perform various actions such as creating a new notebook, a text file or a new folder, as well as access the terminal.
If we want to create a new folder we have to select Folder. This new folder is created within the current directory with the name Untitled Folder which we can change by clicking on the Rename button which appears when selecting the directory box. It can be seen that when selecting the box of any directory or file, other operations such as deleting or moving them, etc., also appear.
To create a notebook we have to select Python 3, which will open a new tab with a blank notebook in which we can start writing our code. As mentioned, these notebooks allow us to combine text and code, organized in cells, which is more comfortable to test things while documenting what we do.
Every notebook has three distinct areas:
- Title: top of notebook. This name is by default Untitled, but we can change it by clicking on it.
- Toolbar: just below the title. It allows us to manage everything related to the notebook.
- Cells: They are like inputs to the Python interpreter where we can write our code. In addition we can also add notes and images or other multimedia elements.
There are two main types of cells:
- Code: Code cells are identified by the label 'In [ ]:' that appears at the beginning of the cell. In these types of cells we can write the Python code that will execute the notebook kernel. After executing the cell, the result produced by the code appears below the cell. In addition, the In[ ] tag now contains a number that indicates the execution order of the cells in the notebook.
After executing the cell:
- Markdown: Markdown cells are where we can include our comments, images and links using the Markdown language which has a very simple syntax.
To run any type of cell, you must click the Run button located on the toolbar. When executing a cell, whatever type it is, a new one appears in white, which by default is code. To change the cell type you have to access the drop-down menu located at the top left called Cell → Cell Type.
In addition, we can also export our notebooks to other formats and share them with whoever we want. Specifically, in the File → Download menu, it gives us the option to download our notebook as an HTML, PDF, Markdown, Python script or Notebook file.
The user should be aware that once a notebook or terminal is launched, Jupyter keeps it running even if you log out to avoid losing progress in the event of a system crash. Therefore, they must be turned off manually once they are finished. In the dashboard you can see that those notebooks that are still running appear in green. We can stop the execution by clicking the Shutdown button that appears by selecting the directory box.
Another way to stop the execution of both notebooks and the terminal is by accessing Running in the upper left menu of the dashboard. There you can see everything that is running and stop it by clicking on the Shutdown button.