JupyterLab for an Enhanced Notebook Experience
by:
blow post content copied from Real Python
click here to view original post
Maybe you’ve already worked with Jupyter Notebooks from Project Jupyter to create documents containing runnable code. You can achieve even more with JupyterLab, a tool kit that you can use to document and share your research, teaching, and learning activities. It’s useful in a wide range of disciplines, from data analysis and data visualization to scientific study.
JupyterLab enhances your notebooks by providing a browser-based interface that allows you to use multiple notebooks together effectively. In addition, it offers you a comprehensive Markdown editor, file manager, file viewer, and an infrastructure that enables you to run code from a wide range of files.
In this tutorial, you’ll learn how to:
- Share code between multiple Jupyter Notebooks
- Debug a Jupyter Notebook
- Create and manage Markdown files
- Run embedded code from a range of different files
- Manage and view different file types from a single interface
- Access your operating system from within JupyterLab
Jupyter is a portmanteau word blended from the three programming languages Julia, Python, and R. Although you’ll focus on Python in this tutorial, you can use Jupyter with the other languages as well. Plus, this free application works on macOS, Linux, and Windows environments.
JupyterLab takes Jupyter Notebook usage to a different level, so you’ll get the most out of this tutorial if you’re already familiar with Jupyter Notebook.
Free Bonus: Click here to download notebooks and files that you can play with in JupyterLab.
Installing and Starting JupyterLab
The cleanest way of installing JupyterLab on a computer is to use a virtual environment. This will ensure that your JupyterLab work doesn’t interfere with any other Python projects or environments that you may already have. For this tutorial, you’ll create a new virtual environment named jl_venv
. Select your operating system to get JupyterLab up and running:
Of course, once you’ve finished this tutorial, you can delete tutorial_project
and add in your own project-specific folders instead.
Note: If you wish, you could create a Samples
subfolder within tutorial_project
and save this tutorial’s downloadable files into it. These include completed versions of the notebooks that you’ll create later on, as well as some other files. This will also give you some files to play around with and will allow you to fully participate in the tutorial.
JupyterLab will start in your web browser, all ready for you to use. But before you dive in, you might want to know how to end your session:
-
To shut JupyterLab down, make sure everything is saved, and then use File → Shut Down to close the application before closing your browser. This will close everything down cleanly. Closing the browser alone doesn’t close the server, while crashing the server may cause data loss.
-
To restart, open either Powershell or your terminal, navigate to your
jupyterlab_projects
folder, then activatejl_venv
. Finally, create or enter your specific project’s folder then start JupyterLab as before. -
To deactivate your virtual environment, use the
deactivate
command. Your command prompt will return to normal.
Once you’ve installed and started JupyterLab, its server will start, along with a web browser connection to it. It may take a moment, but soon you’ll be looking at its main interface:
Because this is your first time running JupyterLab, the front screen shown above contains only a single Launcher window. This is where you can access everything else that’s on offer.
Note: Before you start using JupyterLab, you may like to change its appearance to make it easier for you to use. There are several options available to you:
-
You can hide or display various screen regions using View → Appearance. This is useful if you have a small monitor.
-
You can change the overall theme of the interface by opening Settings → Theme. Themes may help you see more clearly.
-
You can also increase and decrease various font sizes using the options under Settings and Settings → Theme. These may help clarify text.
You can even use your favorite coding font by accessing Settings → Settings Editor and then scrolling down the list of settings on the left until you reach Notebook. Once you’re there, fill out the font family and font size according to your preferences. Then close the Settings tab:
As you can see from the screenshot, you’ve updated the font within your notebooks. If you don’t like your adjustments, then click the big red Restore to Defaults button that appears at the top-right of the Settings screen, and no harm done.
In the upcoming sections, you’ll perform a range of tasks highlighting how JupyterLab’s tools enhance the capability of notebooks. You’ll also see some other interesting features as well.
Understanding JupyterLab Kernels
JupyterLab’s tools support you in your work. Although the tools are self-contained, by using some of them together, you get more out of them. This integration is probably JupyterLab’s most powerful feature.
A good starting point when learning JupyterLab is for you to know what its basic components are and how to make them work together. The diagram below shows an overview of these:
This diagram may look overwhelming at first because there are several parts. Don’t worry, you’ll soon see their relevance. The arrows show how various components interact. These interactions are one of the great benefits of JupyterLab. You’ll start with the central part of the application and the diagram: the kernel.
Read the full article at https://realpython.com/using-jupyterlab/ »
[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]
November 13, 2023 at 07:30PM
Click here for more details...
=============================
The original post is available in Real Python by
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================
Post a Comment