Table of Contents
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
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 onAnaconda Prompt (anaconda3)
as shown below.
- You can also launch Jupyter Notebook by clicking on the
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:
Ensure that your
.jupyter
folder on your local machine has the config file within it. Otherwise, create ajupyter_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:
- 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'] }
- 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:
- 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
- Once inside Jupyter Lab, enter settings by navigating to the menu up-top, clicking on
Settings,
and then clicking onAdvanced Settings Editor.
You can also use the shortcutCtrl+,
to do the same.
- Click on
Notebook
on the left panel. You should next see the following, withSettings
on the left pane andUser 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
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 onAnaconda Prompt (anaconda3)
as shown below.
- You can also launch Jupyter Notebook by clicking on the
Once you are in the Anaconda Prompt,
type in jupyter notebook
as shown below: