Jupyter notebook is slow/laggy, even with refreshed kernel and no outputs/cells running
Asked Answered
S

3

6

Jupyter notebook with about 600 lines or so suddenly got very laggy this past week. Previously all cells would run instantly, the file is mostly just simple pandas aggregations and column functions.

Now, when I reset kernel and outputs, even just clicking into a cell, not even running it, takes ~6 seconds. The screen freezes up, and goes back to normal after a bit. If I run the cell the same thing happens, even though the cell could just be a simple column renaming.

Any ideas? I do not recall changing anything about my Python or Jupyter installation, same packages and everything from a week ago when it worked fine.

Edit: I should add that I restarted computer several times as well but still same poor performance

I created a new notebook, it runs fine, but after a couple hours it slows down as well, even if memory usage is low (just a small dataframe)

Strapper answered 24/3, 2021 at 3:25 Comment(2)
How large is the file?Ruder
Only about 80 KB, the file ran totally fine last week, but now is excruciatingly slow. Must be something under the hood, rather than a CPU or memory bottleneckStrapper
P
4

If you use nbextension for Jupyter try to disable Variable Inspector (Edit -> nbextensions config)

Plunger answered 9/11, 2021 at 2:34 Comment(0)
D
0

The following reasons are possible:

  1. Changes of other software within your systems.
  2. The data to be handled by Pandas is much bigger now and it consume more memory.

Possible ways to find out the cause(s)

  1. Try out same Jupyter Notebook using smaller datasets.
  2. Try out the same Python code using command line instead of from within Jupyter Notebook.

In both cases, you should restart your computer before performing the test. You should also monitor CPU, disk and memory utilization before, during and after.

Dear answered 24/3, 2021 at 3:37 Comment(3)
Chrome in task manager Power Usage jumps to Very High when interacting with notebook...Strapper
I don't think that will tell you the cause unfortunatelyRuder
Did you try option 2), i.e., run it as a python script instead inside a jupyter notebook?Dear
S
0

Turning off my ad-blocker for the jupyter-lab browser tab did the trick for me.

Jupyter lab instantly switched from being near unusably laggy (for things like navigating between cells) to its old instant reaction time.

Surveillance answered 13/8, 2024 at 20:39 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.