Navigating the Jupyter Ecosystem

Table of Contents

  1. Introduction
  2. Jupyter Lab
  3. Jupyter Notebook

   

Disclaimer: The following methods have successfully been tested using Anaconda Navigator (version 1.9.12), Jupyter Lab (version 2.1.5), and Python (version 3.8.3).

Introduction

Using Anaconda, you have the option to launch Jupyter Lab or Jupyter Notebook based on personal preference. Jupyter Lab expands the scope of Jupyter Notebook by adding a modular structure for opening several notebooks/files as tabs in the same window. For more information on Jupyter Lab and Jupyter Notebooks, visit https://www.jupyter.org.

You can launch Jupyter lab by typing the following command in the Anaconda command prompt:

jupyter lab

Similarly, you can launch jupyter notebook by typing the following command in the Anaconda command prompt:

jupyter notebook

Jupyter Lab

  1. Launch Jupyter Lab. Jupyter Lab will open in your default web browser as a new tab.

    • You can also launch Jupyter Notebook by clicking on the Start button on your Windows machine and start typing “Anaconda.” Then click on Anaconda Prompt (anaconda3) as shown below.

Once you are in the Anaconda Prompt, type in jupyter lab as shown below:

Setting the Terminal

By default, Jupyter Lab uses your system’s default terminal. For Windows, it is PowerShell. To change the terminal to a Linux-based command line (i.e., Git Bash), do the following:

  1. Ensure that your .jupyter folder on your local machine has the config file within it. Otherwise, create a jupyter_notebook_config.py file by running the following command in your Anaconda Command Prompt:

    jupyter notebook --generate-config

This will immediately create the jupyter_notebook_config.py file which you will next need to open with a code editor do the following:

  1. Locate the line of code that contains c.NotebookApp.terminado_settings = {}, uncomment it, and replace it with the following:
 c.NotebookApp.terminado_settings = {  
    'shell_command': ['C:\\Program Files\\Git\\bin\\bash.exe']  
} 
  1. Important Note: if you are using Windows, you must have node.js installed on your local machine. To install it, visit https://nodejs.org/en and download the version that is recommended for most users:

  1. Restart Jupyter Lab by exiting/shutting down the application. Open it back up to see the changes applied with the new terminal.

Adjusting User Preferences

  1. Once inside Jupyter Lab, enter settings by navigating to the menu up-top, clicking on Settings, and then clicking on Advanced Settings Editor. You can also use the shortcut Ctrl+, to do the same.

  1. Click on Notebook on the left panel. You should next see the following, with Settings on the left pane and User Preferences on the right:

Adding 80 Character Marker and Showing Line Numbers

Go into User Preferences on the right panel, and type in the following code:

{
    "codeCellConfig": {
// "lineNumbers": True --> to show line numbers
        "lineNumbers": true,
// the following is to limit code to 80 char.
        "rulers": [80],
        "wordWrapColumn": 80
    }
}

If you want to add the 80 character limit ruler to the text editor, then follow steps 1 and 2 above, but on step 2, instead of clicking on Notebook, click on Text Editor instead. Then enter the following code in User Preferences. Notice that most of the code is the same, except for the first variable and lineNumbers are omitted since they exist in the text editor by default. Instead of parsing in codeCellConfig like you would for the Notebook, you will parse in editorConfig to reflect that you are making configuration changes to the text editor.

{
    "editorConfig": {
// the following is to limit code to 80 char.
        "rulers": [80],
        "wordWrapColumn": 80
    }
}

Jupyter Notebook

  1. Launch Jupyter Notebook. Jupyter Notebook will open in your default web browser as a new tab.

    • You can also launch Jupyter Notebook by clicking on the Start button on your Windows machine and start typing “Anaconda.” Then click on Anaconda Prompt (anaconda3) as shown below.

Once you are in the Anaconda Prompt, type in jupyter notebook as shown below:

Previous
Next