How to setup & run JupyterLab Debugger for Python Data Science

1littlecoder · Beginner ·🛠️ AI Tools & Apps ·5y ago

Key Takeaways

Sets up and runs JupyterLab Debugger for Python Data Science

Full Transcript

hey friends welcome to one little coder in this video we are going to look at the latest release of jupiter lab especially we are going to focus on the debugger aspect of it so sometime back jupiter notebook announced jupiter lab announced that uh they are going to support a debugger so why do we need debugger in the first place so if you remember there is a talk from joel gross about why jupiter notebook for that matter is a very bad tool for software development so he was talking particularly about um software development aspect of data science maybe you're developing tools uh or uh something where you actually you know write software um like a code in a software development uh environment then you know using it only for data visualization or model building so that has been a very popular talk and then um many people have tried to give you tools that can help you avoid the problems that he had mentioned one of the important such tool is uh debugger so if you are familiar with software development process one of the things that you would uh probably have to do at multiple instances is that you have to debug your code so if you have to debug your code on the easiest way probably there are a lot of internet memes available for that which is to use a print statement so at every place where you want to debug the tool so you sorry debug the code you would probably put a print statement and then try to understand what is what is that state at that particular point and then you try to understand what is the output of it and then based on that you will try to debug the code even though print statement uh still works but the efficient way is to use a debugger and uh if you see every popular ide would come with a debugger and build it could be vs code python atom all these codes have a debugger installed on by default and then a lot of software developers actively use that um to debug their code so this is a thing that was missing um in jupyter notebook uh sorry jupiter lab also so uh now is the time for us to enjoy that benefit so in this video we're going to see how you can install the latest version of jupyter lab and then how you can have the debugger up and running um that's what we're going to see so let's quickly get started uh so first of all again just add there are a lot other more enhancements as part of this jupyter lab release but we are going to only focus on the jupiter labs debugger tool so first first what we need is we need to install the latest version of jupiter lab so you have to say pip 3 in my case um in your case it could be different pip3 install sorry jupyter lab equal so you're making sure that you are installing the latest third version so it says that uh for a couple of things the um package is already available so that is done so once that is done there is one more small thing that you have to make sure that uh for you to use a debugger you need a separate python kernel you are not going to use the same kernel that uh that that you are using by default so you need a kernel that supports debugging so uh zeus i think that's how we should read uh probably a greek name i'm not sure so zeus python is a kernel jupiter kernel um for python that supports um debugging so we need to install javas python so to install zeus python so what we're going to do is fifth three install zoos sorry python notebook we're going to install this and uh this is also installed so we have installed the two packages that are required for us to perform this task which is debugging a code on jupyter environment so first we installed jupyter lab second we installed that kernel which we are going to use to debug this python code so once that is done we can call our jupyter lab so now i've called the jupiter lab so jupiter lab is loading on my machine so i'm going to take it and then paste it here and then make it big oh it wants my token so let me give the token that it wants or i can probably simply open the entire url which is much more easier for me to do so at this point i'm uh i'm loading the tool so you can see uh that i have i have loaded the tool so i don't want to show you everything that is on my computer so so you can see the reset tools i'm going to close it um i have already installed it so i don't want to show that at this point so you can see uh once i once i opened this so the first thing that you have to make sure is um even if it is already there it is well and fine if it is not there go to extensions extensions here and search for debugger if it's already there it's good if it is not there go to extension and search for debugger and click install so once you click install you know that at this point you have the debugger installed so after you have debugger installed uh first let us try with um with the normal python code so let's go i've just created a new python code i'm going to create a simple function so in this case um i'm going to create a function for addition i'm just basically using their example x y and i'm going to store it in a result x plus y and i'm going to return their result i think i have to probably zoom it in to make it easier yeah i have to yeah so return result this is my function and then after this function i have to call this i'm going to call this saying result equal to add 3 comma 4 comma 5 then result plus equal to 1 and result is what i'm going to print so at this point it prints 10 so when i click jupyter uh notebook now it it opens this but you can see even when the debugger is active you cannot set breakpoints so breakpoints is where you want uh breakpoint is as the name suggest you want your code to stop executing there so that um you can it's like your pause button while the code is getting executed so you want to set those points so you cannot set those points with the default kernel that you're using for python so you need to have a kernel that supports debugging so i'm not sure whether these kernels would have ever support or debugging but for us we have to change the kernel uh so i'm going to go to the x python that we installed if you remember the other package that we installed once i installed x python uh so select that kernel so let me close this you can see there is a button here that is to enable or disable debugger so at this point we can click this and then enable the debugger so we have successfully enabled the debugger after you enable the debugger if you go here you can actually see that it gives you option to set the breakpoints so let me show you quickly one more time so if you are using the default python or anything that you installed you will not be able to set that um you will not be able to set the breakpoint so you need x x uh python kernel that we just installed at the top start so once you have that you have to enable the debugger once you enable the debugger you will be able to set the breakpoint so i'm going to set the breakpoint here and uh probably here and then maybe like here let's say three breakpoints so now you can see that there is uh we have successfully set up three break points so that's what it is showing that there are three break points so for you to see on it it also shows you whether you want the variable or not so uh let me show run once without the variable then i can show you with the variable so select this run it once you run it um you can see that it is it is showing that module 1 this is the location uh where you have the breakpoint so if you click this you can see uh the place uh you know all these things so the first thing is uh it is showing what are all the variables that you have got special variables but function is also within this current session environment so that is there so next you can run this like this you can click next so at this point uh your value of x is 4 and value of y is 5 and then when you click next it is saying the result there is a new variable the result is nine so return result is nine and then when you run this and then it is stopping in the next breakpoint which is uh you you are actually incrementing it so when you run this so the result has become 10 and then when you run this your debugging process is successfully completed so let's let's have a quick look at what happens when you run it uh with uh so it it gives you like this uh with when the variable is um enabled so you what you see is you have an integer currently in the current section you already have an integer so that's what it is showing that because when we ran it first uh we have this integer so if you want you can probably like re restart the kernel uh and clear all the outputs and then you can run it but i'm not going to do that so we can just see so you have a result variable which already says 10 and you have all the functions so let's just for for time being ignore that and then um once you run it so it shows a module one uh line number one and then when you run this sorry i should have clicked next yep and uh and next uh so you have initial variables four and five and then run next uh gives you nine uh as a result x four five and then uh at this point uh you are going into the result uh it's returning the result after you return the result now you have the plus one which is the increment so uh now nine plus one next result is ten so you are showing the result so it is done so if you want to further probably you know try this uh the best way to do it is to put it in a for loop for i in range of 0 to 10 instead of first value i'm going to give like this so let's try to run this once again uh so you can see that uh the function is getting executed um okay let me just run this as well and now you can see uh the function was created now if you see uh the first stage your variables on the this is the first stage so if you run this you can see that um x value is zero and five and then five it just it just keeps on changing one now two no it just you can see what is happening with that so every time the loop is running so this is uh this is really helpful so like i said at the start of the video developers probably would probably what what what would we do so you'd probably say print result here so we'll probably say print result here so like we would have a bunch of print statements uh i'm not saying that it doesn't work but uh i mean still it's a good practice for us to have a proper debugger like if you if you know to use a debugger it's it's really a handy thing for you to have so it's definitely a good thing so you should definitely try to use debuggers and that makes your software development process or even if you're simply writing code for a data visualization data manipulation machine learning so knowing basic software development principles like debugging unit testing so all these things will uh pay good dividends um when when the time is right so that's that's basically about uh the latest debugger so it's not entirely latest so this was available earlier uh but now it is it has been shipped as part of uh the jupiter lab the latest jupiter lab 3.0 so like we discussed initially a quick recap of what we did so we initially we installed the latest version which is version three of jupiter lab after we did that we needed a kernel that supports uh debugging uh so we installed a python kernel that supports debugging which is zoe's python after we install that then we invoked we launched our jupyter lab and then we tried to make sure that uh we have the extension for jupiter uh debugger so just go there search for uh debugger if it is already available you're good it's not just click install uh that would install it once you install that thing you would probably see the debugger here even if you do not see that it doesn't matter really so you have to select create a new kernel um sorry notebook uh click the kernel and then select the ideal kernel in your case which is in our case which is this for python if you are using it for a different language so once you do that uh then you write your code enable the debugger then you will be able to set the breakpoints set the breakpoints run the code debug your code and that should be really good for your software development process and then unlike joel grouse said now jupiter lab is really great extension of jupyter notebook and then that will give you the best of the both worlds so you have a notebook inside a an id and uh if you want to use a notebook with vs code so i've got a separate video for that i'll link that video if you want to check that out but jupiter lab is an amazing id kind of ide on your browser and the other good thing uh probably very quick highlighters um the the thing that i liked is really uh how easy and very responsive it is for mobile environment so if you if i were to go to my settings uh sorry developer tools and then uh if i were to say that um i'm i'm using this uh on mobile environment uh so you you can see how the jupyter notebook is sorry my apologies i have to select this then go developer tools and then click so you can see how responsive it has become which also means uh that using it on mobile is going to be really awesome so if you like probably have got an ipad or something like that so this is this is really very responsive and it does a great job of ipad pro it does a great job of being responsive so it's a good tool it's a really nice tool and i hope you all enjoy the latest release of jupiter lab and if you really like it uh give your shout out to the amazing team that develops this tool as part of their open source initiative and uh show your support to them and if you like this video please give a thumbs up and share it with your friends if you are not subscribed please subscribe and until next video stay safe peace

Original Description

In this Python tutorial, You'll learn how to setup and run JupyterLab Debugger for Python. Knowing how to use your IDE to debug your code can help massively in improving your productivity. The latest version JupyterLab 3.0 comes with Debugger by default and we're going to learn how to set that debugger up and use the debugger to debug our Python code with a simple Python example. JupyterLab - https://blog.jupyter.org/jupyterlab-3-0-is-out-4f58385e25bb xeus-python (Python Kernel that supports Debugging) - https://xeus-python.readthedocs.io/en/latest/installation.html#from-pypi If you want to use VSCode Notebooks - https://youtu.be/ASKaxaTYkOc #Python #datascience #jupyter #jupyternotebook
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from 1littlecoder · 1littlecoder · 0 of 60

← Previous Next →
1 How to create your Free Data Science Blog on Github with Fastpages from Fastai
How to create your Free Data Science Blog on Github with Fastpages from Fastai
1littlecoder
2 Making Interactive Matplotlib Plots for Data Science Visualizations on Jupyter (Python)
Making Interactive Matplotlib Plots for Data Science Visualizations on Jupyter (Python)
1littlecoder
3 Create your first Data Science Web App using R Shiny
Create your first Data Science Web App using R Shiny
1littlecoder
4 How to create a Reproducible Example in R using reprex
How to create a Reproducible Example in R using reprex
1littlecoder
5 No Code Visualization using esquisse with Tableau-like Drag and Drop GUI in R
No Code Visualization using esquisse with Tableau-like Drag and Drop GUI in R
1littlecoder
6 Scrape HTML Table using rvest and Process them for insights using tidyverse in R
Scrape HTML Table using rvest and Process them for insights using tidyverse in R
1littlecoder
7 Google Teachable Machine Learning Build No Code AI solution
Google Teachable Machine Learning Build No Code AI solution
1littlecoder
8 Create meaningful fake tidy datasets in R using fakir [#rstats Package]
Create meaningful fake tidy datasets in R using fakir [#rstats Package]
1littlecoder
9 How to enable using R Programming with Visual Studio VS Code
How to enable using R Programming with Visual Studio VS Code
1littlecoder
10 Python, Community, Books - with Abhiram R - Bangpypers Co-organizers | 1littlecoder podcast
Python, Community, Books - with Abhiram R - Bangpypers Co-organizers | 1littlecoder podcast
1littlecoder
11 Growing a Tech Community across India - Anubha Maneshwar, Founder Girlscript | 1littlecoder Podcast
Growing a Tech Community across India - Anubha Maneshwar, Founder Girlscript | 1littlecoder Podcast
1littlecoder
12 Intro to Google Colab - How to use Colab
Intro to Google Colab - How to use Colab
1littlecoder
13 Intro to Plotly Express - Complex Interactive Charts with One-Line of Python Code
Intro to Plotly Express - Complex Interactive Charts with One-Line of Python Code
1littlecoder
14 Indic NLP Python Toolkit Open Source Development - iNLTK Creator Gaurav Arora | 1littlecoder Podcast
Indic NLP Python Toolkit Open Source Development - iNLTK Creator Gaurav Arora | 1littlecoder Podcast
1littlecoder
15 Do you want a career in Data Science - Tamil Webinar
Do you want a career in Data Science - Tamil Webinar
1littlecoder
16 Android Smartphone Analysis in R [Live Coding Screencast]
Android Smartphone Analysis in R [Live Coding Screencast]
1littlecoder
17 Programmatically create Images, Memes, Watermarks using Python with imgmaker
Programmatically create Images, Memes, Watermarks using Python with imgmaker
1littlecoder
18 Kaggle Walkthrough to get you started with Data Science - Webinar
Kaggle Walkthrough to get you started with Data Science - Webinar
1littlecoder
19 Community, Corporate Job, Coding - Gnana Lakshmi T C aka Gyan, WomenWhoCode Leadership Fellow
Community, Corporate Job, Coding - Gnana Lakshmi T C aka Gyan, WomenWhoCode Leadership Fellow
1littlecoder
20 Easy ggplot2 Theme Customization with {ggeasy} | Data Visualization in R
Easy ggplot2 Theme Customization with {ggeasy} | Data Visualization in R
1littlecoder
21 Excel to R - Pivot + Bar Chart in Excel  & R using tidyverse [Live Coding]
Excel to R - Pivot + Bar Chart in Excel & R using tidyverse [Live Coding]
1littlecoder
22 Excel to R #2 - VLOOKUP in Excel to LEFT_JOIN, MERGE in R
Excel to R #2 - VLOOKUP in Excel to LEFT_JOIN, MERGE in R
1littlecoder
23 5 websites to get Free Real-World Datasets for Data Science/ML Projects
5 websites to get Free Real-World Datasets for Data Science/ML Projects
1littlecoder
24 Excel to R #3 - APPROXIMATE VLOOKUP in Excel to FUZZY LEFT_JOIN in R
Excel to R #3 - APPROXIMATE VLOOKUP in Excel to FUZZY LEFT_JOIN in R
1littlecoder
25 Correlation-alternative PPS (Predictive Power Score) Python Package Demo
Correlation-alternative PPS (Predictive Power Score) Python Package Demo
1littlecoder
26 Automated Website Screenshots in R using {webshot}
Automated Website Screenshots in R using {webshot}
1littlecoder
27 Installing Custom RStudio Theme (Synthwave85)
Installing Custom RStudio Theme (Synthwave85)
1littlecoder
28 Analyse Google Trends Search Data in R using {gtrendsR}
Analyse Google Trends Search Data in R using {gtrendsR}
1littlecoder
29 3 Tips to ask question on Stack Overflow the right way to get answers
3 Tips to ask question on Stack Overflow the right way to get answers
1littlecoder
30 Learn Data Science with R - Mini Projects - Web Scraping Zomato
Learn Data Science with R - Mini Projects - Web Scraping Zomato
1littlecoder
31 Easily make Dumbbell Chart using {ggcharts} | Data Visualization in R
Easily make Dumbbell Chart using {ggcharts} | Data Visualization in R
1littlecoder
32 GET Hackernews Front Page Results using REST API in R
GET Hackernews Front Page Results using REST API in R
1littlecoder
33 Quickly deploy ML WebApps from Google Colab using ngrok
Quickly deploy ML WebApps from Google Colab using ngrok
1littlecoder
34 Use Jupyter Notebooks within VSCode (Visual Studio Code) in 2020
Use Jupyter Notebooks within VSCode (Visual Studio Code) in 2020
1littlecoder
35 Plotly Interactive Plots as Pandas Plotting Backend df.plot()
Plotly Interactive Plots as Pandas Plotting Backend df.plot()
1littlecoder
36 Stack Overflow Developer Survey 2020 Highlights for New Programmers
Stack Overflow Developer Survey 2020 Highlights for New Programmers
1littlecoder
37 Matplotlib Animation Charts in Python using Celluloid
Matplotlib Animation Charts in Python using Celluloid
1littlecoder
38 Coding, Postwoman, Passion Project Book - Liyas Thomas Open Source Developer - 1littlecoder podcast
Coding, Postwoman, Passion Project Book - Liyas Thomas Open Source Developer - 1littlecoder podcast
1littlecoder
39 Aspiring Data Scientist, Tips on How to learn Business Domain Knowledge
Aspiring Data Scientist, Tips on How to learn Business Domain Knowledge
1littlecoder
40 Bokeh Interactive Charts as Pandas Plotting Backend df.plot_bokeh()
Bokeh Interactive Charts as Pandas Plotting Backend df.plot_bokeh()
1littlecoder
41 Easy Fast Python Pandas Summary with Sidetable | Pandas Tips & Tricks
Easy Fast Python Pandas Summary with Sidetable | Pandas Tips & Tricks
1littlecoder
42 Inception, Content Ideas, Consistency - Srivatsan Srinivasan AIEngineering YouTube Content Creator
Inception, Content Ideas, Consistency - Srivatsan Srinivasan AIEngineering YouTube Content Creator
1littlecoder
43 ggplot2 Text Customization with ggtext | Data Visualization in R
ggplot2 Text Customization with ggtext | Data Visualization in R
1littlecoder
44 Penguins Dataset Overview - iris alternative | EDA Data Visualization in R
Penguins Dataset Overview - iris alternative | EDA Data Visualization in R
1littlecoder
45 YouTube Growth Tips, Content Creation - Bhavesh Bhatt, YouTuber (Data Science & Machine Learning) #7
YouTube Growth Tips, Content Creation - Bhavesh Bhatt, YouTuber (Data Science & Machine Learning) #7
1littlecoder
46 Matplotlib Animated Bar Chart Race in Python | Data Visualization
Matplotlib Animated Bar Chart Race in Python | Data Visualization
1littlecoder
47 Simple Python GUI Development using {guietta}
Simple Python GUI Development using {guietta}
1littlecoder
48 #8 Niche, Growth, Monetization - David Langer - YouTuber Dave on Data
#8 Niche, Growth, Monetization - David Langer - YouTuber Dave on Data
1littlecoder
49 Simple Fast 3-step Python OCR using Deep Learning 40+ Languages
Simple Fast 3-step Python OCR using Deep Learning 40+ Languages
1littlecoder
50 Github New Feature Profile Summary/Mini-Resume - Profile Views
Github New Feature Profile Summary/Mini-Resume - Profile Views
1littlecoder
51 Otto ML Assistant, GPT-3 on Philosophers, Nvidia-ARM - 3 ML Tech News
Otto ML Assistant, GPT-3 on Philosophers, Nvidia-ARM - 3 ML Tech News
1littlecoder
52 What is OpenAI GPT-3 - Hype, Examples, Worries
What is OpenAI GPT-3 - Hype, Examples, Worries
1littlecoder
53 Julia 1.5, Datamuse API, Live HDR+ Pixel 4a - Machine Learning Tech News
Julia 1.5, Datamuse API, Live HDR+ Pixel 4a - Machine Learning Tech News
1littlecoder
54 Self-driving Car Engineer sentenced, arXiv Dataset, AI/ML Startup Idea - Machine Learning Tech News
Self-driving Car Engineer sentenced, arXiv Dataset, AI/ML Startup Idea - Machine Learning Tech News
1littlecoder
55 GPT-3 Explorer, Ciphey (Automated Decryption), Py-Sudoku - ML Tech News
GPT-3 Explorer, Ciphey (Automated Decryption), Py-Sudoku - ML Tech News
1littlecoder
56 How to use Advanced Google Search to extract Email Ids from Linkedin
How to use Advanced Google Search to extract Email Ids from Linkedin
1littlecoder
57 Cartoonizer Toon-IT (AI Web App), GPT-3 Advice, Android Earthquake Detection - ML Tech News
Cartoonizer Toon-IT (AI Web App), GPT-3 Advice, Android Earthquake Detection - ML Tech News
1littlecoder
58 Flow - R Package to visualize code logic, functions as a Flow Diagram
Flow - R Package to visualize code logic, functions as a Flow Diagram
1littlecoder
59 Build GPT-3-like Language Model on Google Colab with minGPT [PyTorch]
Build GPT-3-like Language Model on Google Colab with minGPT [PyTorch]
1littlecoder
60 Create a Pencil Sketch Portrait with Python OpenCV
Create a Pencil Sketch Portrait with Python OpenCV
1littlecoder

Related Reads

Up next
Best AI Tools for Social Media Marketing in 2026 (Beginner-Friendly AI Tools)
Pin Generator
Watch →