Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New version of Jupyter notebook is extremely slow #7069

Closed
kongfanmiao opened this issue Aug 11, 2021 · 44 comments
Closed

New version of Jupyter notebook is extremely slow #7069

kongfanmiao opened this issue Aug 11, 2021 · 44 comments
Assignees
Labels
info-needed Issue requires more information from poster perf Performance issues

Comments

@kongfanmiao
Copy link

Issue Type: Performance Issue

Recently I updated my jupyter notebook in vscode. I''m glad that many jupyter features are supported in the nee version. However, I found that the execution of jupyter cells become extremely slow. I wrote some code to record the real execution time of my code. It turns out that the real execution time is not so long. But the time shown in the left-bottom cornor of jupyter cells are much longer than the real execution time. Sometime the reaction time is also exetremely slow, for example I pressed 'Shift+Enter' but it takes even one minute to start to execute the cell.

VS Code version: Code 1.59.0 (379476f0e13988d90fab105c5c19e7abc8b1dea8, 2021-08-04T23:13:12.822Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No
Remote OS version: Linux x64 4.4.0-19041-Microsoft

System Info
Item Value
CPUs Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (4 x 3192)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 63.89GB (52.36GB free)
Process Argv --folder-uri=vscode-remote://wsl+Ubuntu/mnt/c/kfm/Computation --remote=wsl+Ubuntu --crash-reporter-id 608d2da6-c9b1-441b-a70e-018fd8f4ecf8
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu
OS Linux x64 4.4.0-19041-Microsoft
CPUs Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (4 x 3192)
Memory (System) 63.89GB (52.36GB free)
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    0	   111	  4500	code main
    0	   100	  4528	   window (undefined)
    0	    86	  5460	   window (Issue Reporter)
    0	    27	  6552	   crashpad-handler
    0	   114	  7628	   window (undefined)
    0	   303	  9812	   gpu-process
    0	    90	 11504	   shared-process
    0	    66	 10288	     ptyHost
    0	    41	 11572	   utility
    1	   862	 13980	   window (● pprVO.ipynb - Computation [WSL: Ubuntu] - Visual Studio Code)
    0	   123	  8300	     extensionHost
    0	    65	  8232	       electron_node wslDaemon.js 
    0	     8	  1632	         C:\WINDOWS\System32\wsl.exe -d Ubuntu sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 379476f0e13988d90fab105c5c19e7abc8b1dea8 stable .vscode-server 0  '
    0	    12	  5740	           console-window-host (Windows internal process)
    0	     8	 10688	           C:\WINDOWS\system32\lxss\wslhost.exe {a54a2b26-e418-4524-99ca-55fd4d1733f8} 508 516 520
    0	    14	 10432	             console-window-host (Windows internal process)

Remote: WSL: Ubuntu
CPU %	Mem MB	   PID	Process
    1	     0	   129	remote agent
    0	     0	   140	   ptyHost
    0	     0	   197	     /bin/bash
   19	     0	   166	   watcherService
   23	     0	   185	   extensionHost
    0	     0	   339	     /home/kfm/.vscode-server/bin/379476f0e13988d90fab105c5c19e7abc8b1dea8/node /home/kfm/.vscode-server/extensions/ms-python.vscode-pylance-2021.8.0/dist/server.bundle.js --cancellationReceive=file:d3dd6329a670fe53ae94e44c4b717a4a3d908af328 --node-ipc --clientProcessId=185
    0	     0	   411	     /home/kfm/Programs/anaconda3/bin/python -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
    0	     0	   412	     /home/kfm/Programs/anaconda3/bin/python -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
    0	     0	   413	     /home/kfm/Programs/anaconda3/bin/python -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
    0	     0	   424	     /home/kfm/Programs/anaconda3/bin/python -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
    0	     0	   426	       electron_node oMNPM.js 
    0	     0	   819	   /bin/sh -c /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0	     0	   820	     /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
Workspace Info

|  Remote: WSL: Ubuntu|    Folder (Computation): 10449 files|      File types: 1(1819) xsf(788) log(481) psf(368) cube(365) nc(364)
|                  fdf(322) xml(276) ion(273) xyz(210)
|      Conf files: settings.json(2);
Extensions (16)
Extension Author (truncated) Version
remote-ssh ms- 0.65.7
remote-ssh-edit ms- 0.65.7
remote-wsl ms- 0.58.2
material-icon-theme PKi 4.9.0
ayu tea 0.20.1
vscode-icons vsc 11.6.0
json-parse-validator Adr 1.1.2
vscode-ipython Che 0.6.2
nbpreviewer jit 1.2.2
linter-gfortran krv 2.3.0
MagicPython mag 1.1.0
python ms- 2021.8.1105858891
vscode-pylance ms- 2021.8.0
jupyter ms- 2021.8.1195043623
cpptools ms- 1.5.1
markdown-all-in-one yzh 3.4.0

(3 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspyt653:30270858
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30300192
pythontb:30283811
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805cf:30301675
pythonvspyt200:30340761
vscextlang:30333561
binariesv615:30325510
pythonvssor306:30344512
bridge0708:30335490
vstre464cf:30350173

@rebornix rebornix transferred this issue from microsoft/vscode Aug 11, 2021
@greazer greazer added the perf Performance issues label Aug 12, 2021
@greazer greazer added this to the August 2021 milestone Aug 12, 2021
@ubalklen
Copy link

Same here. I've noticed as soon as you activate the Jupyter extension, CPU consumption stays high even if the notebook is not running anything. It didn't happen before the update.

@DonJayamanne
Copy link
Contributor

soon as you activate the Jupyter extension, CPU consumption stays high even if the notebook is not running anything. It didn't happen before the update.

@ubalklen Please could you file a separate issue for this with the CPU profile.

@DonJayamanne
Copy link
Contributor

nd that the execution of jupyter cells become extremely slow. I wrote some code to record the real execution time of my code. It turns out that the real execution time is not so long

Thanks for filing this issue, we're currently looking into performance issues related to execution of cells in notebooks.

@ubalklen
Copy link

soon as you activate the Jupyter extension, CPU consumption stays high even if the notebook is not running anything. It didn't happen before the update.

@ubalklen Please could you file a separate issue for this with the CPU profile.

There you go: #7142

@DonJayamanne
Copy link
Contributor

@kongfanmiao
Please could you provide some sample code used to check the difference between the two?

@kongfanmiao
Copy link
Author

@kongfanmiao
Please could you provide some sample code used to check the difference between the two?

I used the most simple case, even computing 1+1 takes about 30 seconds.

@DonJayamanne
Copy link
Contributor

Ok, so the delay is not in running a cell, but in starting the kernel.
I.e. once you have run the first cell, running subsequent cells, such as 1+1 again doesn't take 30seconds. is that correct?

@kongfanmiao
Copy link
Author

Ok, so the delay is not in running a cell, but in starting the kernel.
I.e. once you have run the first cell, running subsequent cells, such as 1+1 again doesn't take 30seconds. is that correct?

Not really. Actually the case is the opposite. The first time I run "1+1" was very fast. The second time it took 30 seconds.

@greazer greazer modified the milestones: August 2021, September 2021 Aug 27, 2021
@DonJayamanne
Copy link
Contributor

@kongfanmiao Please could you install the latest VS Code insiders and try this out. (we've made a lot of improvements with regards to notebooks).

Also, please could you provide the logs from the Jupyter Output panel.

@DonJayamanne DonJayamanne added the info-needed Issue requires more information from poster label Aug 31, 2021
@greazer
Copy link
Member

greazer commented Sep 2, 2021

Fixes that were in insiders have been promoted to VS Code stable v1.60. So any fixes that addressed this problem should be available there.

@DeemanOne
Copy link

Hey just wanted to let you know that I have the same issue, still after the latest update (think it was 1.61)

@greazer
Copy link
Member

greazer commented Sep 21, 2021

Thank you for the feedback! Closing for now. Please reopen and provide the log from the Jupyter Output Panel as requested above. We can't determine what might be going on without those.

@greazer greazer closed this as completed Sep 21, 2021
@DavidKutu DavidKutu removed this from the September 2021 milestone Sep 29, 2021
@ahoho
Copy link

ahoho commented Oct 20, 2021

I'm experiencing the same problem. On Windows, running a notebook on a remote Ubuntu server, I will get large delays between simple executions (e.g., an a=1 assignment). See how things take a minute between runs.

Info 2021-10-20 21:39:04: Execute Cells request 1 8
Info 2021-10-20 21:39:04: Execute Cell 8 file:///my-file.ipynb # cell 1 has already run, hit shift+enter to run cell 2
Info 2021-10-20 21:39:44: Execute Cells request 1 8
Info 2021-10-20 21:39:44: Execute Cell 8 file:///my-file.ipynb # cell 2 runs, hit shift+enter to run cell 3
Info 2021-10-20 21:40:37: Execute Cells request 1 8
Info 2021-10-20 21:40:37: Execute Cell 8 file:///my-file.ipynb # cell 3 has run

@rchiodo
Copy link
Contributor

rchiodo commented Oct 20, 2021

@ahoho does %%time return it taking 60 seconds? That would mean the problem is in the kernel. Might be related to intellisense (this bug here: #1300)

@ahoho
Copy link

ahoho commented Oct 25, 2021

I do not have the variables window open. Unfortunately, moving to Insiders does not seem to help.

Also of note: when running a longer cell with a tdqm progress bar, it only updates intermittently as well.

@DonJayamanne
Copy link
Contributor

when running a longer cell with a tdqm progress bar, it only updates intermittently as well.

Please could you file a seprate issue for this, I'd like to get to the bottom of that issue.

@ahoho
Copy link

ahoho commented Oct 25, 2021

Please could you file a seprate issue for this, I'd like to get to the bottom of that issue.

I can do that, but I strongly suspect it's the same root cause.

@taigaoma1997
Copy link

taigaoma1997 commented Nov 9, 2021

I also have the same issue, anyone knows how to fix this?

My jupyter is fine when running the first time. But after running several cells, it gets extremely slow. When I press "run", it didn't start to run until 10 or 20 seconds later. I also couldn't interrupt the kernel, since interrupt/restart also gets very slow.

Another situation I noticed is that, if in my code cell, I accidentally write some typo, e.g., I used a variable/function that was never defined before, it gets extremely slow, and after a long time it will tell me that this variable/function is not defined; or I accidentally missed a ":" in the while loop, it will also take a long time to find this typo.

OS: Ubuntu 20.04.3 LTS (Focal Fossa)
Python: 3.8.12
Python Extension: v2021.11.1422169775
Jupyter Extension: v2021.10.1001414422
VS code: 1.62.1

@DonJayamanne

@DonJayamanne
Copy link
Contributor

@taigaoma1997

I'd like to address these perf issues, please could you help us by providing some more information.

I also have the same issue, anyone knows how to fix this?

Please could you provide the following information:

  • What is slow? Running a cell for the first time, interrupting, or running subsequent cells?
  • What is your:
    • OS
    • Python version
    • Version of the Python extesnion
    • Version of the Jupyter extension
    • Version of VS COde
  • Output from the Jupyter output panel

@philmade
Copy link

philmade commented Nov 11, 2021

I've got the same problem. Jupyter is basically not running properly. I'm on Windows, I'm running it on WSL2. Python version is 3.9.7. Python extensions version v2021.11.1422169775, Jupyter version v2021.10.1001414422.

The output of the Jupyter Terminal also hangs and gives spinning wheel. It takes a long while for the jupyter extension to load , then when it finally loads I can run perhaps one cell (importing some packages or some trivial thing) before it stops working. The next cell - also just setting various variables - won't run. The whole notebook now just hangs and doesn't do anything. Then after a while it stops hanging and I can run the next cell. But then the whole process repeats until it loses all stability and effectively crashes.

I should add that even saving the notebook is impossible. I lost a lot of work yesterday because of this - I re-wrote the code today and now I see how unstable Jupyter is running. It won't save, and if vscode the code is gone.

I am using a python poetry environment as my interpreter, I wonder if this has something to do with it?

@taigaoma1997
Copy link

I've got the same problem. Jupyter is basically not running properly. I'm on Windows, I'm running it on WSL2. Python version is 3.9.7. Python extensions version v2021.11.1422169775, Jupyter version v2021.10.1001414422.

The output of the Jupyter Terminal also hangs and gives spinning wheel. It takes a long while for the jupyter extension to load , then when it finally loads I can run perhaps one cell (importing some packages or some trivial thing) before it stops working. The next cell - also just setting various variables - won't run. The whole notebook now just hangs and doesn't do anything. Then after a while it stops hanging and I can run the next cell. But then the whole process repeats until it loses all stability and effectively crashes.

I should add that even saving the notebook is impossible. I lost a lot of work yesterday because of this - I re-wrote the code today and now I see how unstable Jupyter is running. It won't save, and if vscode the code is gone.

I am using a python poetry environment as my interpreter, I wonder if this has something to do with it?

I basically have the same situation as you, When it gets stuck, I cannot interrupt, restart the kernel, I also cannot save or close the notebook. It is very inconvenient at this time.

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Nov 11, 2021

@taigaoma1997 @NomeChomsky
I'd like to address these perf issues, please could you help us by providing some more information.

Please provide the following (if you haven't already provided this):

  • Sample notebook when running into this (or do you run into this with any python code such as print("Hello World")
  • OS
  • Python version
  • Version of the Python extesnion
  • Version of the Jupyter extension
  • Version of VS Code
  • Output from the Jupyter output panel (Use the command Jupyter: Show Output to get to it.)
  • Output from the Console window (use the command Developer: Toggle Developer Tools & go itno the console tab)

Please note, the output from the Jupyter & Console window is important, that's where we log everthing. Use the command Jupyter: Show Output to get to it.

I also cannot save or close the notebook. It is very inconvenient at this time.

Its possible the extension host is hung or something else,

@philmade

This comment has been minimized.

@philmade

This comment has been minimized.

@DonJayamanne

This comment has been minimized.

@philmade

This comment has been minimized.

@philmade

This comment has been minimized.

@DonJayamanne

This comment has been minimized.

@philmade

This comment has been minimized.

@DonJayamanne

This comment has been minimized.

@DonJayamanne
Copy link
Contributor

@taigaoma1997

I basically have the same situation as you, When it gets stuck, I cannot interrupt, restart the kernel, I also cannot save or close the notebook. It is very inconvenient at this time.

Please could you create a new issue with the details of the OS, Python & extension versions including the logs. I'd like to get you unblocked here.

@taigaoma1997
Copy link

@taigaoma1997

I basically have the same situation as you, When it gets stuck, I cannot interrupt, restart the kernel, I also cannot save or close the notebook. It is very inconvenient at this time.

Please could you create a new issue with the details of the OS, Python & extension versions including the logs. I'd like to get you unblocked here.

Hi, it is wried that last several days it can run pretty smooth without changing anything. This also happened before but becomes extremely slow later. I will show the logs later when I meet this problem again.

@DonJayamanne
Copy link
Contributor

Thanks, im going to close this issue as resolved.
If you or anyone runs into this or similar issues again, please file a new issue or please feel free to reopen this

@david1111039243
Copy link

david1111039243 commented Nov 21, 2021

Having the same issue here. Running a jupyter notebook and it was working, now running incredibly slowly and only simple functions. I often have to quit out but similar issue happens after running a few cells in the notebook.

Visual Studio Code Version: 1.62.3 (Universal)
Mac OS 11.6 Big Sur
Python 3.9.2 64 bit
running Jupyter extension v2021.10.1101450599
python extension v2021.11.1422169775

Tried running print('hello world') and it worked, but took a long time (see screenshot 40+ seconds)

Screen Shot 2021-11-20 at 7 19 00 PM

Other more complex cells in book not running - it seems to time out mid way and give an 'x' icon (see screenshot)
Screen Shot 2021-11-20 at 7 17 12 PM

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Nov 21, 2021

@david1111039243 please could you create a new issue
Also please do try vscode insiders, we've addressed a few of the perf issues.l and added some additional logging to identify these perf issues.

when filing the issue, please turn logging to verbose and then provide the logs from the Jupyter output panel.

@david1111039243
Copy link

david1111039243 commented Nov 21, 2021

What is vscode insiders? And apologies what is 'verbose' - I'm new on github and to coding.

I posted a new issue here #8320

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster perf Performance issues
Projects
None yet
Development

No branches or pull requests

14 participants