JupyterLab Notebook doesn't recognise the code

Hi!
Today I wanted to try out JupyterLab on my own PC after using it on university computer but I cannot do anything with it. I am in Code mode and no matter what I type in, the commands do not become colorised and there is no output. Preloaded notebooks work just fine but I cannot create anything on my own. I’ve tried restarting the kernels and it doesn’t help either.


What could be the problem?

For one thing, I don’t think you are accomplishing what you describe as “Today I wanted to try out JupyterLab on my own PC …”. I’d suggest installing the Anaconda Distribution for Windows. It will include JupyterLab that you can start up from the Anaconda Navigator. That install of JupyterLab on your PC will have a full Python kernel that runs on your machine like typical installed software. (If you are a Windows/Jupyter power-user, see here for how to install and run JupyterLab on your own Windows machine with full control over all the specifics. However, I suspect that is overwhelming for most people who just want it working and are willing to accept what Anaconda says is a good situation.)
There’s also the JupyterLab Desktop App that is billed as “the quickest and easiest way to get started with Jupyter notebooks, with the flexibility for advanced use cases” here. The links are here.


If you want to stick with the ‘Pyodide’ kernel (as indicated in the upper right of your screenshot):

What you show in the screenshot is JupyterLite running inside your browser. If you go to the main page about here, you’ll see that high voltage symbols next to ‘Status’ are there to highlight that you should be careful as it is experimental. (That specific term is actually used to describe JupyterLite highlighted by warning symbols on the Try Jupyter page.) You’ll occasionally hit weird things like you are reporting. I’ve seen it where you have to give it a good time to start up and if you try to start a few new notebooks too fast that sometimes it will get caught in the start-up in those. One workaround is to close your JupyterLab and then go there and then right-click on the ‘Lab’ button in the upper left and choose to open in Incognito mode. Or open it in a different browser. Now when it opens there, try to very patiently open a new notebook, waiting until the busy kernel indicator fully is empty before you try to run some code in it.

The ‘Python Pyodide (Pyolite)’ kernel you are using in JupyterLite differs from what I’m suggesting to run JupyterLab on your own machine by installing the Anaconda Distribution. The ‘Python Pyodide (Pyolite)’ kernel uses Web Assembly (WASM) to run inside your browser. It is actually running WASM-based virtual-like environment in your browser and currently has limited ability to interact with the files in your system’s main drive. Just like javascript running on a web page cannot easily access the files in your local drive because of security concerns.

JupyterLite is great for giving you a sense of how the JupyterLab looks and behaves as an interface right now. (That is a big part of why if you go to the Try Jupyter page presently, and choose JupyterLab tile, you get JupyterLite. The other reasons it is is super fast to start up compared to a session running via MyBinder, which most of the other tiles there use besides JupyterLab and the classic notebook interface. More importantly, because the computation is taking place deep inside your browser, it doesn’t cost cloud computing resources on a remote virtual machine like MyBinder-served sessions do add up to real $. That has taken a large load off the costs to run the Try Jupyter offering the last few months.) Ultimately, JupyterLite will allow Jupyter to reach more people and be more portable, however, right now you’ll have an easier time using more traditional routes for your computational endeavors.



If you want actual JupyterLab with a typical, full Python kernel backing it without installing anything because it is served via a remote server, go here and click on ‘launch binder’. That session is served via the MyBinder service and is temporary. It will time out if you don’t use it for like 10 minutes. Once the session times out, you’ll lose your work with no way to get it back, and so save often back to your local machine if you make anything useful. Then when you start a new session, drag-and-drop it form your local machine into the file browser panel on the left side in a new JupyterLab session to continue working on it later.

1 Like