3. Jupyter Lab#

Author: Tue Nguyen

3.1. Outline#

  • What is Jupyter Lab?

  • What is an IDE?

  • How to start Jupyter Lab

  • Jupyter Lab interface

  • Create your first notebook using Jupyter Lab

3.2. What is Jupyter Lab?#

  • Jupyter Lab is an integrated development environment (IDE) commonly used for interactive coding with languages such as Python, R, and Julia

  • An IDE is simply a text editor with some features that make coding easier and more efficient such as

    • Syntax highlighting

    • File organization/navigation

    • Code execution

    • Integrated terminal

    • Debugger

  • In fact, Jupyter is an acronym for Julia-Python-R

  • You can also you Jupyter Lab with other scripting languages such as Matlab or Octave

  • Jupyter Lab is the next generation of Jupyter Notebook

    • It fully supports Jupyter Notebook

    • It has a better GUI and many more features/enhancements that boost your productivity

  • Besides Jupyter Lab, you can use other IDEs such as

    • Pycharm

    • Spyder

    • Visual Studio Code

    • Zeppelin

3.3. Install Jupyter Lab#

  • Jupyter Lab come with Anaconda, so you don’t need to install it separately

3.4. Start Jupyter Lab#

  • Now you can launch Jupyter lab and start coding

  • First, go inside the root folder of your project

  • Then right-click on a blank space, and choose Git Bash Here

  • A Git Bash terminal opens (this is why we installed Git in the previous chapter)

  • Type the jupyter lab and hit Enter

  • Jupyter Lab will be launched via a new tab on your default browser (Ex: Chrome, Firefox)

  • For a better experience, I recommend you set a modern browser such as Chrome or Microsoft Edge as your default browser

3.5. Jupyter Lab’s interface#

3.6. Create your first notebook#

  • Your project can contain only a single notebook or a collection of notebooks, depending on the complexity of your analysis

  • Each notebook is a piece of analysis that contains code and explanatory tex

  • As you can see in the left panel in the picture above, there are 6 notebooks (files with extensions .ipynb)

  • Now, right-click the big rectangle button with a plus sign on the left panel

    • A launcher panel will appear on the right listing several options

    • You can choose to create a new notebook, text file, or terminal

  • To create a new notebook, choose Python 3 (ipykernel) as shown in the picture below.

3.7. Practice#

3.7.1. Exercise 1#

  1. Create a folder named test/ on your computer

  2. Launch Jupyter Lab inside test/

  3. Create three sub-folders and rename them data/, nb/, and /docs (Hint: use the left panel)

  4. Go inside data/ and upload a random file (Hint: use the left panel)

  5. Go inside nb/, create a new notebook and rename it to analysis.ipynb

  6. Go inside docs/, create a new text file and rename it to manual.txt