Jupyter Lab not executing Python code

Hoping someone can help! I’ve built some jupyter lab notebooks in June 2023 for my students to work through this school year, but now that I’ve come back to Jupyter Labs, none of my code markdown is executing. I don’t get any output.

Any ideas? What could I be missing?

Figured it out - I had to click the little, “Save and create checkpoint” button after loading my old notebooks. Sorry! Rookie mistake :wink:

I doubt that ‘solution’ was really the trick. You are using Pyodide in JupyterLite (I assume from your screenshot) and probably weren’t letting the kernel start before attempting to run code. The Pyodide kernel running in JupyterLite takes a bit longer to start up than full, typical Python kernel running in Jupyter and if you try to kick off executing the cells too soon in JupyterLite, you can lock it up. Make sure you let the busy indication in the upper right next to the ‘Python (Pyodide)’ text is fully clear first before attempting to run your code. I’m just suggesting this because if you are using that kernel/JupyterLite for teaching, which I’d advise against, you probably should understand some of the quirks and limitations.

By the way the example you show isn’t ‘markdown’ code. Markdown it is the text that goes in markdown cells. You are showing Python code in your example. It’s a little weird that it isn’t showing syntax highlighting in your screenshot. But that maybe because you weren’t giving it a chance to do what it needs to do before triggering execution. UPDATE: Yes, that is the phenomena you’ll see about highlighting if you jump the gun and don’t wait for the kernel to start properly first. I just checked myself with putting in that same print “Hello World” code. A good trick to get a separate ‘clean slate’-state for JupyterLite, especially if your standard window seems glitchy like you show, is to open it in Incognito mode.

And those aren’t necessarily ‘JupyterLab notebooks’. Those .ipynb notebook files should run in any Jupyter environment that is suitable, whether it is JupyterLab, JupyterLite, Jupyter Notebook V7, or NbClassic. If some of those don’t make sense, see the bottom part of this recent post.

Hi fomightez,

You’re right: the kernel was not loading for me. When I restarted in a incognito window the kernel started up in just a few seconds, but in my regular browser window the kernel is stuck at “kernel status: unknown” with the lightning-circle symbol.

I deleted my cookies for jupyter.org and reloaded and that seemed to do the trick.

1 Like