Getting Started with JupyterLab Tutorial
In this article, we will introduce you to JupyterLab, one of the most popular IDE for data science.
En este artículo, le presentaremos JupyterLab, uno de los IDE más populares para la ciencia de datos.
It’s impossible to understand software development without programming languages. True, a software developer with no programming language is like a taxi driver with no car. However, things are more complex. Just as GPS makes taxi drivers’ life easier, so does Integrated Development Environments (also known as IDEs) for programmers.
Es imposible comprender el desarrollo de software sin lenguajes de programación. Es cierto que un desarrollador de software sin lenguaje de programación es como un taxista sin coche. Sin embargo, la situación es más compleja. Así como el GPS facilita la vida a los taxistas, también lo hacen los Entornos de Desarrollo Integrados (también conocidos como IDE) para los programadores.
IDEs are designed to enable programmers to write code and develop software applications more efficiently. IDEs increase programmer productivity by putting together multiple utilities into a single interface. Writing, testing, and debugging code, as well as editing functionalities, such as syntax highlighting, bracket-matching, and code autocompletion, are among the most common features of modern IDEs.
Los IDE están diseñados para que los programadores puedan escribir código y desarrollar aplicaciones de software de forma más eficiente. Aumentan la productividad del programador al integrar múltiples utilidades en una única interfaz. Escribir, probar y depurar código, así como editar funcionalidades como el resaltado de sintaxis, la coincidencia de corchetes y el autocompletado de código, se encuentran entre las características más comunes de los IDE modernos.
There are many IDEs particularly well-suited for data science, including DataCamp’s DataLab. In this article, we will introduce you to JupyterLab, the next generation of Jupyter Notebook, probably the most popular IDE for data science. Released in 2018, JupyterLab offers a flexible user interface and more features than the classic Jupyter Notebook, and it’s certainly the present and the future of Project Jupyter. Willing to get started with JupyterLab? Keep reading!
Existen muchos IDE especialmente adecuados para la ciencia de datos, incluyendo DataLab de DataCamp. En este artículo, te presentaremos JupyterLab, la nueva generación de Jupyter Notebook, probablemente el IDE más popular para la ciencia de datos. Lanzado en 2018, JupyterLab ofrece una interfaz de usuario flexible y más funciones que el Jupyter Notebook clásico, y sin duda representa el presente y el futuro del Proyecto Jupyter. ¿Te animas a empezar con JupyterLab? ¡Sigue leyendo!
A Brief Introduction to Jupyter Notebook
When Jupyter Notebook was launched for the first time in 2014, it rapidly revolutionized the IDE landscape. Recently considered one of the most important computing projects, which has changed the process of scientific publishing forever, Jupyter has become the de facto standard in data science.
Cuando Jupyter Notebook se lanzó por primera vez en 2014, revolucionó rápidamente el panorama de los IDE. Considerado recientemente uno de los proyectos informáticos más importantes, que ha revolucionado para siempre el proceso de publicación científica, Jupyter se ha convertido en el estándar de facto en ciencia de datos.
Jupyter Notebook works as a server-client application, allowing coders to edit and run notebooks via a web browser. The application can be executed on a computer without Internet access, or it can be installed on a remote server, where you can access it through the Internet.
Jupyter Notebook funciona como una aplicación cliente-servidor, lo que permite a los programadores editar y ejecutar cuadernos mediante un navegador web. La aplicación puede ejecutarse en un ordenador sin acceso a Internet o instalarse en un servidor remoto, accesible a través de Internet.
Initially designed to support Julia, Python, and R –three of the most popular programming languages for data science–today, Jupyter supports over 40 programming languages.
Inicialmente diseñado para soportar Julia, Python y R (tres de los lenguajes de programación más populares para la ciencia de datos), hoy en día Jupyter admite más de 40 lenguajes de programación.
Jupyter is made of two main components.
Kernel. It is a program that runs and introspects the user’s code. By default, Jupyter has a kernel for Python code, but there are also kernels available for other programming languages.
Kernel. Es un programa que ejecuta e introspecciona el código del usuario. Por defecto, Jupyter tiene un kernel para código Python, pero también existen kernels disponibles para otros lenguajes de programación.
Dashboard. A notebook is primarily composed of a cell sequence, which can contain elements such as code, text, visualizations, images, and formulas. Besides cells, the dashboard includes various tools to configure the notebook workflow, debug code, export notebooks in different formats, browse documents, and many more.
Panel de control. Un cuaderno se compone principalmente de una secuencia de celdas, que puede contener elementos como código, texto, visualizaciones, imágenes y fórmulas. Además de las celdas, el panel de control incluye diversas herramientas para configurar el flujo de trabajo del cuaderno, depurar código, exportar cuadernos en diferentes formatos, explorar documentos y mucho más.
Como versión mejorada de Jupyter Notebook, JupyterLab agrega nuevas características y capacidades, aunque los componentes principales permanecen intactos.
As an improved version of Jupyter Notebook, JupyterLab adds new features and capabilities, although the core components remain intact.
Getting Started with JupyterLab
In order to use JupyterLab, you first will need to install it on your computer, as with any other program. This can be done in different ways, depending on your preferences: using pip, Anaconda, or Docker.
Para usar JupyterLab, primero deberá instalarlo en su computadora, como cualquier otro programa. Puede hacerlo de diferentes maneras, según sus preferencias: usando pip, Anaconda o Docker.
Installing JupyterLab with pip
Pip is the standard package manager in Python. To install JupyterLab with pip, you just have to run on the command line:
>>pip install jupyterlab
After running this instruction, pip will install the JupyterLab packages as well as all the dependencies required for JupyterLab to function. If you want to know more about how to manage packages in Python, check out our Pip Python Tutorial for Package Management.
Once you have successfully installed JupyterLab on your computer, you just have to run the following statement to open up JupyterLab:
>>jupyter lab
Then you’ll see the application opening in your preferred web browser on the following address: http://localhost:8888/lab
Installing JupyterLab with Anaconda
Anaconda is a package manager, an environment manager, and a Python distribution that contains a collection of many open-source packages. Anaconda is a great choice if you want to get started in data science. You no longer need to worry about how to install Python or JupyterLab, as they get installed automatically in modern Anaconda distributions.
Anaconda es un gestor de paquetes, un gestor de entornos y una distribución de Python que contiene una colección de numerosos paquetes de código abierto. Anaconda es una excelente opción si quieres iniciarte en la ciencia de datos. Ya no tienes que preocuparte por cómo instalar Python o JupyterLab, ya que se instalan automáticamente en las distribuciones modernas de Anaconda.
The easiest way to launch JupyterLab is through the Anaconda Navigator, an application that allows you to make use of Anaconda functionalities in a user-friendly and no-code way. As you can see in the picture below, both Jupyter Notebook and JupyterLab are already installed. You just have to click on the Launch button to open JupyterLab on your web browser.
La forma más sencilla de iniciar JupyterLab es a través de Anaconda Navigator, una aplicación que permite usar las funcionalidades de Anaconda de forma intuitiva y sin necesidad de programar. Como puede ver en la imagen a continuación, tanto Jupyter Notebook como JupyterLab ya están instalados. Solo tiene que hacer clic en el botón “Iniciar” para abrir JupyterLab en su navegador web.
However, in certain cases –for example, when you create a new conda environment–, you may need to install JupyterLab on that environment. To do so, the fastest way is by running the following on the conda command line (Anaconda Prompt on Windows and terminal on macOS and Linux):
Sin embargo, en ciertos casos (por ejemplo, al crear un nuevo entorno de Conda), es posible que necesite instalar JupyterLab en dicho entorno. Para ello, la forma más rápida es ejecutar lo siguiente en la línea de comandos de Conda (símbolo del sistema de Anaconda en Windows y terminal en macOS y Linux):
>>conda install -c conda-forge jupyterlab
Installing JupyterLab with Docker
Docker is an open platform to run software in containers. These containers are self-contained and isolated processes that allow you to separate your applications from your infrastructure so you can deliver software quickly.
Docker es una plataforma abierta para ejecutar software en contenedores. Estos contenedores son procesos autónomos y aislados que permiten separar las aplicaciones de la infraestructura para entregar software rápidamente.
If you have Docker installed, you can install and use JupyterLab by selecting one of the many Docker images supported by the Jupyter Docker Stacks. You can consider these images as pre-packaged bundles of software that can be automatically downloaded from Docker when you run them.
Si tiene Docker instalado, puede instalar y usar JupyterLab seleccionando una de las muchas imágenes de Docker compatibles con Jupyter Docker Stacks. Puede considerar estas imágenes como paquetes de software preempaquetados que se descargan automáticamente de Docker al ejecutarlos.
For example, if you want to install Doker’s image jupyter/datascience-notebook, which includes libraries for data analysis from Julia, Python, and R, you just have to run the following on the Docker command:
Por ejemplo, si quieres instalar la imagen jupyter/datascience-notebook de Doker, que incluye bibliotecas para análisis de datos de Julia, Python y R, solo tienes que ejecutar lo siguiente en el comando Docker:
>>docker run -it -p 10000:8888 -e JUPYTER_ENABLE_LAB=yes jupyter/scipy-notebook
For more details and examples on how to use JupyterLab on Docker, check out the documentation. Also, for a detailed introduction to Docker, we highly recommend this DataCamp tutorial.
JupyterLab Interface
JupyterLab interface is a remastered version of the Jupyter Notebook interface, providing a new set of modular building blocks for interactive and efficient computing. JupyterLab integrates several coding tools into one single interface, thus offering a coding experience that resembles more to traditional IDEs.
La interfaz de JupyterLab es una versión remasterizada de la interfaz de Jupyter Notebook, que proporciona un nuevo conjunto de bloques de construcción modulares para una computación interactiva y eficiente. JupyterLab integra varias herramientas de programación en una única interfaz, ofreciendo así una experiencia de programación similar a la de los IDE tradicionales.
JupyterLab interface comprises the following main elements:
Work area. The main work area comes with a new tab-based layout that allows you to combine different documents (notebooks, data files, HTML, pdfs, images, etc.) and coding tools (terminal, code consoles, text editor, etc.) into panels of tabs that can be resized or subdivided through drag and drop. The tab-based system, absent in Jupyter Notebook, allows for more integrated and efficient programming, as developers are able to do most of their tasks without leaving JupyterLab.
Left sidebar. The collapsible sidebar contains various commonly-used tabs, including:
File browser. It allows you to manage files and folders on your computer.
Tab and kernel manager. It provides a list of tabs in the main work area and of running kernels and terminals.
Table of contents. An interactive index based on headings included in markdown cells.
Extension manager. It allows you to install new applications and plugins to improve your JupyterLab experience (see more below).
Right sidebar. A second collapsible sidebar that contains:
Property inspector. It allows you to inspect with close detail the information and properties of the cells.
Debugger (see more below)
Menu bar. The menu bar at the top of JupyterLab includes top-level menus with actions available in JupyterLab. The different menus are:
File: actions related to files and directories.
Edit: actions related to editing documents and other activities.
View: actions that change the appearance of JupyterLab.
Run: actions for running code in different activities.
Kernel: actions for managing kernels.
Tabs: a list of the open documents and activities in the work area.
Settings: common settings and an advanced settings editor. One of the coolest features of JupyterLab is the possibility to choose different themes for the interface, including Dark Mode.
Help: a list of JupyterLab and kernel help links.
Debugging in JupyterLab
The goal behind debugging is to point out the causes of the bugs found in your program during the testing process, and thus adjust your code to output your accurate and desired result.
Data progressions, and more broadly, software developers, monitor the interactions between and changes in the program’s variables in a debugging process. You can investigate the potential causes for the errors in your program by seeing how each different function, method, or even line of code alters the value and functionality of the variables.
Jupyter Notebook and the first versions of JupyterLab incorporated the %debug built-in magic command to conduct debugging tasks. However, the tool is quite rudimentary compared to debuggers in other IDEs.
Luckily, the latest versions of JupyerLab include a Debugger front-end by default, It includes the traditional debugging capabilities, including setting breakpoints, stepping into functions, and inspecting variables. You can activate it from the right sidebar, as shown in the image below:
JupyterLab Extensions
JupyterLab is already a powerful and well-equipped tool, with new features that will make your coding experience more IDE-like. However, if you feel that some functionalities are missing or you want to enhance JupyterLab capabilities, you should check Jupyter Extensions.
Written in JavaScript, JUpyterLab extensions are pieces of software containing one or more plugins to add new capabilities to JupyterLab, such as new themes, file editor, and new command shortcuts.
There are two types of JupyterLab extensions:
Prebuilt extension. They don’t require a rebuild of JupyterLab.
Source extension. They require a rebuild of JupyterLab when installed. Rebuilding JupyterLab requires Node.js –an open-source, cross-platform environment for running JavaScript applications– to be installed.
If you use conda with conda-forge packages, you can get Node.js with:
>>conda install -c conda-forge nodejs
There are several ways to manage JupyterLab extensions, but we highly recommend you use the built-in Extension Manager. Accessed through the puzzle icon on the life sidebar, the Extension manager allows you to install and disable extensions with no coding required.
For more information about JupyterLab extensions and how to manage them, check out JupyterLab documentation.
JupyterLab vs Jupyter Notebook
Below, you can find a table of differences between Jupyter Notebook and JupyterLab:
Jupyter Notebook JupyterLab
Release date 2014 2018
Open source? Yes Yes
Tab system
Single tab
Multiple, modular tabs, everything in one view
Debugging capabilities
%debug magic command
Debugger
Data file viewer
Data files view as text files
Data can be viewed in table format
Coding experience
Feels like a standalone tool
Feels like an IDE
Themes by default
White
Light and Dark
Advantages
Simplicity Steep learning curve
Modular and customizable tabs provide efficiency and flexibility. Provide tools and features that increase productivity.
Disadvantages
Changing between notebooks and documents can be tedious. Limited tools and features.
May feel over-engineered because of the many features. Shallow learning curve
Future developments
Remains as a legacy old version
The future of the Project Jupyter
DataLab
If you’re looking for an online, cloud-based IDE that allows you to write code and analyze data collaboratively and share your data insights, DataLab is a great choice. Built by DataCamp, DataLab is a cloud-based data analysis platform that is designed to help you get started quickly and easily. With DataLab, you can skip the time-consuming setup process and start working with data right away. There is no need to install anything, as everything is accessible through the browser.
When using DataLab, you’ll find built-in datasets that you can use instantly, as well as pre-built templates with pre-written code. DataLab is accessible to all skill levels, with low and no-code tools available to create stunning reports and visualizations.
It also supports Python and R, both with native SQL integrations and comes pre-configured and pre-installed with the world’s most popular data science packages.
Run and edit the code from this tutorial online
Conclusion
You made it to the end. Congratulations! We hope you enjoyed this tutorial about JupyterLab. Because of its cell-based structure, which focuses on interactive, exploratory computing, Jupyter rapidly became a revolutionary tool, the preferred IDE for data professionals. Compared to Jupyter Notebook, JupyterLab is a more refined tool, bringing together the best of notebooks and traditional IDEs, such as RStudio, and PyCharm.
So, if you are new to data science and wonder whether you should choose Jupyter Notebook or JUpyterLab, we highly recommend you choose the latter. Willing to know more about Jupyter? Check out the following DataCamp materials:
SQL Interface Within JupyterLab tutorial
Jupyter Notebook Tutorial: The Definitive Guide
Markdown in Jupyter Notebook Tutorial
Jupyter Notebook Cheat Sheet
JupyterLab Tutorial FAQs
What is an IDE?
IDEs are programs designed to enable programmers to write code and develop software applications more efficiently. IDEs increase programmer productivity by putting together multiple utilities into a single interface.
What is JupyterLab?
JupyterLab is the latest Jupyter’s web-based IDE for notebooks, code, and data.
What is a notebook? A notebook is a document that contains elements such as code, equations, visualizations, and text, following a cell-based structure. Can I use Python in JupyterLab? Yes, as well as other programming languages for data science, such as R, and Julia What is JupyterLab Extension Manager? It allows you to install new applications and plugins to improve your JupyterLab experience Should I choose Jupyter Notebook or JupyterLab? Since JupyterLab is the present and the future of the Jupyter Project, we highly recommend you choose JupyterLab.