JupyterLite suddenly not working with interactive image processing code

Hello. It has been a while I posted here.
I have been using JupyterLite frequently and it has shown to be very functional and complete. However, one particular notebook that was perfectly functional now isn’t working anymore.
image
The image above is the standard image that is shown when the notebook cells are initially executed.
image
What was supposed to happen is, as the slider moves, the quality of the image decreases with k and increases with k. This was working. Now it isn’t. The value of the compression ratio changes to 82.26%, but the image doesn’t change its quality and the compression ratio doesn’t change from 82.26%.
I am not sure why this is happening. I thought that it is due to an update in one of the used packages (I am using numpy, scikit-image and ipywidgets) or in the Pyodide kernel, but other notebooks I have created that use numpy and ipywidgets are working perfectly, so I don’t think that’s it. I think that maybe it is due to the browser storage, but I don’t understand why it was working before and isn’t now.
So, I ask your help to understand why this sudden change, and what must I try to do such that, as the user changes the value of k using the slider, he/she can see the quality of the image and the compression ratio change in real time. Has any specific update happened to something? Is it the browser storage?
Thank you.

This is probably it. I’ve seen it happen to simpler notebooks.
There’s several ways to try and get around it.
The easiest is to try another browser or try incognito/private mode to start up the JupyterLite session and then open the notebook there.
One way is that you can make a new notebook that works and copy over the code. There’s ways to do this programmatically with nbformat that would probably be more convenient than selecting and dragging cells in the JupyterLab-flavor JupyterLite with both notebooks arranged side-by-side, see here and here. Start with a different name to the notebook to attempt things and keep the name of the file very tiny and without any spaces or weird characters.
Try a different computer or another JupyterLite site are other ways to work around this.
Usually, eventually you can get the original one working again after using the workarounds for a while.
I assume you tried a hard browser reload in your browser of the page itself, too?
Remember to be very patient. Always let the kernel get unbusy before you start running cells initially. That is usually a surefire way to glitch it up.


Finally, depending on your computational needs, a fully typical Python backed kernel in a session served by MyBinder may be advised for now until it starts working again in your JupyterLite session.


This below is key to my thinking the browser storage is your issue as your surmised:

As long as it uses very similar code and the same packages, it is one of the best ways to track down the issue to something that due to the complexities of browser storage is vexing & really not as easily fixed directly as far as I know.

On the other hand, ipywidgets can be difficult to debug even with a full Python kernel in the JupyterLab interface. It seems you are sure you ruled out coding subtleties, but I’ll just mention this for other who may find this thread.

1 Like

Hello. I am thankful for your answer. I haven’t had the opportunity to rewrite this notebook but I did try another browser and incognito mode and I still got the same results… I had to focus on another notebook that is more urgent for my project and I noticed that half of the notebook isn’t being displayed. The only code cell that is shown is the initial one, which imports some of the packages I use. I observed this error in both browsers I use, and while accessing the environment using my mobile phone’s browser. I added the notebook to another repository with less files and the same thing happened. Are you aware of any type of update that JupyterLite went through recently that made these mistakes appear? These things were not happening before. I wish to fix this soon, since I need to use make the material available for a class.
You have helped me so much throughout the development of this project that I can’t thank you enough. I hope you can help me once more. Thank you.

Not particular to JupyterLite, however, here was reports in some browsers of cells vanishing. Is that what you see?

Yes, similar to that. I don’t know what could have caused that in my case, because I don’t use Safari (I don’t have MacBook and I use Opera). I managed to fix it using the canonical solution of deleting the flawed notebook and commiting another notebook with the order of the cells altered. It is functional now. I’m still curious to know what was this error caused by, if it is something specific to JupyterLite, or if it is universal to all JupyterLab distribuitions, or if it was an error while commiting the notebook. I will still try to fix the image processing example soon, and I will get back to you. If you find a possible explanation as to why this error occured, please inform me, as I will try to avoid this error again. Thank you.