16

I’ve got trouble with Jupyter in vscode. On vs code start-up, my 10 cells “run all” in about 3-4 minutes in a perfectly sensible way (loading the data and heavy calculations take time, but plotting is fast, etc). But re-running cells sometimes takes forever.

As an example, the last cell, which is just plotting the data, took 1.6s on 'run all'. When I instantly re-run that last cell (even without changing the code at all), it takes much longer to run (up to 14 minutes!). Why is that?

It isn’t a CPU or memory problem because those climb to only 30% and 75% during the runs, respectively.

I’ve seen the same error on a Jupyter notebook server. The solution was to disable “Variable Inspector nbextension”. Is there an equivalent solution when running jupyter notebooks on vs code?

UPDATE: It's only the case when the "Jupyter: Variables" pane is open. A lot of variables are shown as loading endlessly. The problem might be that the variables are too big to show?

Versions: vs code 1.73.1 / Jupyter v2022.9.1303220346 / Python 3.10.8 / Windows 11

Note: I have pandas variables, just like in the problem in the above link.

8
  • does that mean your re-run is fast when you don't have pandas variables? Can you create a dummy pandas DataFrame and a plot of that variable that takes a long rerun time? Do you have the same problem if you use the Interactive Python version
    – rioV8
    Commented Dec 6, 2022 at 14:11
  • 1) No, I didn't mean re-run was fast without pandas. I just happens that the other link that's closely related to mine specifically mentioned that so I thought appropriate to mention it too. Commented Dec 6, 2022 at 16:30
  • 2) I did try with a small example but it runs and re-runs completely smoothly. Commented Dec 6, 2022 at 16:30
  • 1
    [ Note that I've updated my comment: The re-run (on my application, not the dummy example) is fast when the "Jupyter: Variables" pane is closed. When it's open, the re-run is very slow, and I noticed a lot of variables are shown as loading endlessly. This might be the source of the problem. ] Commented Dec 6, 2022 at 16:33
  • 3) I'm not sure whether or not I'm currently using the Interactive Python version? I'm running cells manually (they look like cells and not like a regular text file). My code is in a ipynb file. Commented Dec 6, 2022 at 16:36

0