Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Jupyter notebook slow to load and unresponsive

At some point one of my SageMath Jupyter notebooks became very slow to respond to the mouse and keyboard: mouse clicks now take several seconds to register and keystrokes appear only after a long lag. When the notebook is opened in a browser tab, it can take five minutes or more for any of the cells to show up. I have other notebooks open in the same browser window that load instantly and are very responsive. I'm running in Safari on a MacBook pro.

I tried many things to rectify the issue, including restarting the kernel, clearing all outputs, shutting down the kernel and restarting, shutting down the browser, shutting down the machine, and creating a copy of the notebook and running that. None of these had any effect. This notebook does not contain any graphics or any particularly large input our output cells. I finally solved the issue by extracting all input cells by hand and copying them into a fresh notebook. This fresh notebook now has essentially the same visible content as the old one, but is much more responsive and loads right away. Evidently there is some invisible content in the old notebook that is causing issues.

Can anyone suggest a work-around that is less cumbersome than what I ended up resorting to? Any ideas as to what might have caused this?

Jupyter notebook slow to load and unresponsive

At some point one of my SageMath Jupyter notebooks became very slow to respond to the mouse and keyboard: mouse clicks now take several seconds to register and keystrokes appear only after a long lag. When the notebook is opened in a browser tab, it can take five minutes or more for any of the cells to show up. I have other notebooks open in other tabs of the same browser window that load instantly and are very responsive. I'm running in Safari on a MacBook pro.

I tried many things to rectify the issue, including restarting the kernel, clearing all outputs, shutting down the kernel and restarting, shutting down the browser, shutting down the machine, and creating a copy of the notebook and running that. None of these had any effect. This notebook does not contain any graphics or any particularly large input our output cells. I finally solved the issue by extracting all input cells by hand and copying them into a fresh notebook. This fresh notebook now has essentially the same visible content as the old one, but is much more responsive and loads right away. Evidently there is some invisible content in the old notebook that is causing issues.

Can anyone suggest a work-around that is less cumbersome than what I ended up resorting to? Any ideas as to what might have caused this?

Jupyter notebook slow to load and unresponsive

At some point one of my SageMath Jupyter notebooks became very slow to respond to the mouse and keyboard: mouse clicks now take several seconds to register and keystrokes appear only after a long lag. When the notebook is opened in a browser tab, it can take five minutes or more for any of the cells to show up. I have notebooks open in other tabs of the same browser window that load instantly and are very responsive. I'm running in Safari on a MacBook pro.

I tried many things to rectify the issue, including restarting the kernel, clearing all outputs, shutting down the kernel and restarting, shutting down the browser, shutting down the machine, and creating a copy of the notebook and running that. None of these had any effect. This notebook does not contain any graphics or any particularly large input our output cells. I finally solved the issue by extracting all input cells by hand and copying them into a fresh notebook. This fresh notebook now has essentially the same visible content as the old one, but is much more responsive and loads right away. Evidently there is some invisible content in the old notebook that is causing issues.

Can anyone suggest a work-around that is less cumbersome than what I ended up resorting to? Any ideas as to what might have caused this?

Update: In response to a suggestion from rburing, I looked at the text of my notebook files, which convinced me that there isn't any hidden information that might be causing the problem. After some experimentation, I discovered that an aspect of my old notebook that I thought completely innocuous appears to be causing the issue. That notebook contained a large number of one- or two-line calculation cells at the end that I originally didn't bother copying over to my new notebook, thinking they couldn't possibly be important. As I began copying these cells to the new notebook, that notebook also began to grind to a halt. I then did the following experiment: I created notebook1, containing 512 cells, each containing

a = 2+2
print(a)

I created notebook2 containing eight cells, each containing the above code repeated 64 times. I executed all cells in both notebooks and saved. I then restarted the web browser and loaded both notebooks. It took about 3.5 minutes for notebook1 to load, but only a few seconds for notebook2 to load.

So is the lesson from all this that one shouldn't use a notebook structure with lots of small cells?