How to add debugger to Jupyter Lab

Is there an extension that adds debugger capability to Jupyter Lab 4.0.11?
I read about a Xeus kernel that has to be used but the documentation there says it can cause conflicts if you have the full Anaconda distribution installed.

See the bottom of my post here covering that the visual debugger is built in to JupyterLab now and that ipykernel, the typical Python kernel everyone uses, works with it now. There’s links there to resources supporting this.

1 Like

I entered the following commands to enable debugging. Now in Jupyter Lab the debugger icon is seen (at the upper right next to “ipykernel” ) but it is greyed out:

conda create -n jupyterlab-debugger -c conda-forge jupyterlab=4 “ipykernel>=6” xeus-python
conda activate jupyterlab-debugger
conda install jupyterlab dask pandas hvplot
conda install -c conda-forge condastatsconda install -c conda-forge condastats
conda install -c conda-forge jupyter_contrib_nbextensions

Any idea why the debugger is disabled?

I’m not seeing anything obvious. When you click on it, does the panel come up on the right? Did you clear all the old installations out of your system before doing this? Someone had a thread here trying to get help with a situation that sounds somewhat like yours. You can probably work through what was asked there to look around and see if you can find the cause in your case, ignoring the xeus-python stuff. (Although you did install that one, too.) That may give you a direction to go after further investigation.

For comparison, you can go here and click ‘launch binder’ to get a session where it works in JupyterLab 4.1. That way you’ll know what you should be seeing in the case of using the ipykernel at least.

Minor aside: you don’t need jupyter_contrib_nbextensions. It doesn’t have anything to do with current JupyterLab.

I have just started using the Jupyter tools for the first time. I will delete the 2 environments I have already created and make a new env. This time I will skip the xeus-python and nb_extensions. Plus I will play close attention to which extensions are installed.

I deleted the 2 environments which I had made:
conda env remove --name env1
conda env remove --name jupyterlab-debugger
And created a new environment:
conda create -n jupyterlab-debugger -c conda-forge jupyterlab=4 “ipykernel>=6”
conda activate jupyterlab-debugger
conda install jupyterlab dask pandas hvplot
conda install -c conda-forge condastats
And these are my installed extensions
jupyter-notebook-lab-extension 7.0.8
jupyter-widgets-jupyterlab-manager 5.0.9
jupyterlab-plotly 5.9.0
lckr-jupyterlab-variableinspector 3.1.0
pyviz-jupyterlab-pyviz 3.0.0
I am still seeing the debugger icon greyed out and the mouse pointer becomes a circle with a line through it.

I tried the example debugging session you provided and the debugger worked correctly. I noticed there were no extensions installed. I tried to uninstall the extensions which I listed above. Each time it says “You will need to refresh the web page to apply the changes.” Is that referring to the refresh icon next to the back arrow in the browser? Only “lckr-jupyterlab-variableinspector 3.1.0” is no longer showing. The other 4 extensions are still there with “Uninstall” and “Disable” buttons. The Anaconda powershell has versions JupyterLab 4.1.5 and IPyKernel 6.29.3. Debugger icon is still greyed out.

Whenever you see that and you are having issues, it means ideally restart everything, the browser and Jupyter. Maybe even reboot your system. Refresh everything as much as you can when troubleshooting.
You can try just reloading the browser page at another time when things work on that system and you are maybe redoing things later.

Which internet browser works best with Jupyter Lab. I have tried Edge and Chrome.

I use Chrome and haven’t seen any issues recently.

I have the debugger working with my program now!
I found this kernel configuration JSON file:

C:\Users\miket\anaconda3\share\jupyter\kernels\python3\kernel.json

and it had:

“metadata”: {
“debugger”: false
}

I changed it to ‘true’ and now the debugger is working. (I like the way it adds new variables to the watch window as you step through the code.)

So this should all work without any extensions?

1 Like

Yes. Zero extensions needed these days. It is built in to the JupyterLab and will work as long as the kernel supports it. ipykernel supports it, and so it should work with the typical Python kernel.

Thanks for reporting the configuration file was the underlying cause of blocking it from working for you. Hopefully this will help someone else’s struggle to be much shorter.

I decided to completely uninstall Anaconda because I could not uninstall the extensions. Then after running the installation I opened my notebook and the same extensions were showing at first, to my surprise. But then next time I started my computer they were all gone and the icon for the extensions manager was gone too. Now I can do Settings > Enable Extension Manager

1 Like

I’ve been hitting similar issues and noticed it may be related to the version of ipykernel. Can you try installing this specific version and see it it works?

ipykernel==6.9.1

Other potential fix is in Navigator is go into the kernel.json file and change the debugger value from false to true as mentioned above.

You should see it somewhere like this in your anaconda folders.
/Users/XXXX/opt/anaconda3/envs/name/share/jupyter/kernels/python3/kernel.json

1 Like