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

ipywidgets cause cell to run 30x+ times slower #15699

Open
1 of 2 tasks
movy opened this issue May 18, 2024 · 0 comments
Open
1 of 2 tasks

ipywidgets cause cell to run 30x+ times slower #15699

movy opened this issue May 18, 2024 · 0 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@movy
Copy link

movy commented May 18, 2024

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

Since several versions ago, cells that involve ipywidgets code, run many times slower than cells with similar code w/o ipywidgets. When running the same notebook in browser jupyter lab, cells with and w/o ipywidgets execute immediately.

I tried disabling extensions, run CPU profiling etc -- there is no clear indication of any direct culprit, which makes me think it's either Jupyter extension or VSCode itself.

The attached notebook involves simple code, so difference between execution times of 0.065s and 2.623s does not seem significant, but in real-world scenarios ipywidgets cell execution takes MINUTES, often with subsequent hanging of
VSCode remote server, i.e. causing sporadic reconnects despite stable connection, and eventually asking to reload window.

CPU profiling logs and notebook are attached below.

CPU-20240518T073123.245Z.cpuprofile.txt.zip

ipwidgets_test.ipynb.zip

VS Code Version

Version: 1.89.1 (Universal) Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685 Date: 2024-05-07T05:14:24.611Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Darwin x64 22.6.0

Jupyter Extension Version

v2024.4.0 and v2024.4.2024042601 (pre-release)

Jupyter logs

Visual Studio Code (1.89.1, ssh-remote, desktop)
Jupyter Extension Version: 2024.4.0.
Python Extension Version: 2024.6.0.
Pylance Extension Version: 2024.5.1.
Platform: linux (x64).
Workspace folder ~/jesse-bot, Home = /home/ubuntu
15:48:46.709 [info] Telemetry level is off
15:48:46.709 [info] Experiments are disabled, only manually opted experiments are active.
15:48:47.762 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd0ead1b95f633dc9c51826328e1846203f51a198c6fb5f2884a80417ba131d4e82./bin/python3.11./bin/python3.11.-m#ipykernel_launcher  (Python Path: /bin/python3.11, Unknown, Python 3.11.6, 3.11.6) for '/Volumes/Backup/home/Downloads/peaks_detection_test.ipynb' (disableUI=true)
15:48:47.763 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd0ead1b95f633dc9c51826328e1846203f51a198c6fb5f2884a80417ba131d4e82./bin/python3.11./bin/python3.11.-m#ipykernel_launcher  (Python Path: /bin/python3.11, Unknown, Python 3.11.6, 3.11.6) for '~/jesse-bot/Research-Backtest-MA.ipynb' (disableUI=true)
15:48:47.785 [error] Failed to validate Password info D [FetchError]: request to http://localhost:8888/ failed, reason: connect ECONNREFUSED 127.0.0.1:8888
    at ClientRequest.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/node-fetch.js:1:306417)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED'
}
15:48:47.789 [error] Failed to validate Password info D [FetchError]: request to http://localhost:8888/ failed, reason: connect ECONNREFUSED 127.0.0.1:8888
    at ClientRequest.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/node-fetch.js:1:306417)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED'
}
15:48:47.847 [error] Error fetching kernels from http://localhost:8888/ (localhost): FetchError: request to http://localhost:8888/api/kernels?1716022127788 failed, reason: connect ECONNREFUSED 127.0.0.1:8888
    at ClientRequest.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/node-fetch.js:1:306417)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
15:48:47.848 [error] Error fetching kernels from http://localhost:8888/ (localhost): FetchError: request to http://localhost:8888/api/kernels?1716022127791 failed, reason: connect ECONNREFUSED 127.0.0.1:8888
    at ClientRequest.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/node-fetch.js:1:306417)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
15:48:47.848 [error] Jupyter Lab Helper:getKernelSpecs failure:  Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed.
    at v.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935)
    at ni.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299)
    at r.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:191:14050)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at __.listKernelsFromConnection (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:296:20211)
    at /home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:296:17636
15:48:47.850 [error] Jupyter Lab Helper:getKernelSpecs failure:  Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed.
    at v.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935)
    at ni.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299)
    at r.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:191:14050)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at __.listKernelsFromConnection (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:296:20211)
    at /home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:296:17636
15:48:47.856 [error] Failed to validate Password info D [FetchError]: request to http://localhost:8888/ failed, reason: connect ECONNREFUSED 127.0.0.1:8888
    at ClientRequest.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/node-fetch.js:1:306417)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED'
}
15:48:47.858 [error] Failed to validate Password info D [FetchError]: request to http://localhost:8888/ failed, reason: connect ECONNREFUSED 127.0.0.1:8888
    at ClientRequest.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/node-fetch.js:1:306417)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED'
}
15:48:47.865 [error] Error fetching kernels from http://localhost:8888/ (localhost): FetchError: request to http://localhost:8888/api/kernels?1716022127857 failed, reason: connect ECONNREFUSED 127.0.0.1:8888
    at ClientRequest.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/node-fetch.js:1:306417)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
15:48:47.865 [error] Error fetching kernels from http://localhost:8888/ (localhost): FetchError: request to http://localhost:8888/api/kernels?1716022127859 failed, reason: connect ECONNREFUSED 127.0.0.1:8888
    at ClientRequest.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/node-fetch.js:1:306417)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
15:48:47.866 [error] Jupyter Lab Helper:getKernelSpecs failure:  Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed.
    at v.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935)
    at ni.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299)
    at r.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:191:14050)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at __.listKernelsFromConnection (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:296:20211)
    at /home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:296:17636
15:48:47.866 [error] UniversalRemoteKernelFinder: Failed to get kernels without cache FetchError: request to http://localhost:8888/api/kernels?1716022127857 failed, reason: connect ECONNREFUSED 127.0.0.1:8888
    at ClientRequest.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/node-fetch.js:1:306417)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
15:48:47.867 [error] Jupyter Lab Helper:getKernelSpecs failure:  Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed.
    at v.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935)
    at ni.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299)
    at r.dispose (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:191:14050)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at __.listKernelsFromConnection (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:296:20211)
    at /home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/extension.node.js:296:17636
15:48:47.867 [error] UniversalRemoteKernelFinder: Failed to get kernels without cache FetchError: request to http://localhost:8888/api/kernels?1716022127859 failed, reason: connect ECONNREFUSED 127.0.0.1:8888
    at ClientRequest.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/dist/node_modules/node-fetch.js:1:306417)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
15:48:49.650 [warn] Failed to get activated env vars for /bin/python3.11 in 1888ms
15:48:49.651 [warn] Failed to get activated env vars for /bin/python3.11 in 1878ms
15:48:49.652 [warn] Failed to get activated env vars for /bin/python3.11 in 1300ms
15:48:49.663 [info] Process Execution: /bin/python3.11 -c "import site;print("USER_BASE_VALUE");print(site.USER_BASE);print("USER_BASE_VALUE");"
15:48:49.684 [info] Process Execution: /bin/python3.11 -m pip list
15:48:49.692 [info] Process Execution: /bin/python3.11 -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
15:48:49.701 [info] Process Execution: /bin/python3.11 -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
15:48:49.712 [info] Process Execution: /bin/python3.11 -m ipykernel_launcher --f=/home/~/.local/share/jupyter/runtime/kernel-v2-1072876pO8XAKQf7V0H.json
    > cwd: //home/~/jesse-bot
15:48:49.722 [info] Process Execution: /bin/python3.11 -m ipykernel_launcher --f=/home/~/.local/share/jupyter/runtime/kernel-v2-1072876uFIivB24Vdbv.json
    > cwd: ~/jesse-bot
15:48:50.232 [info] Process Execution: /bin/python3.11 /home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0-linux-x64/pythonFiles/printJupyterDataDir.py
15:49:36.740 [info] Handle Execution of Cells 0,1,2 for /Volumes/Backup/home/Downloads/peaks_detection_test.ipynb
15:49:37.146 [info] Cell 0 completed in 0.394s (start: 1716022176752, end: 1716022177146)
15:49:37.237 [info] Cell 1 completed in 0.065s (start: 1716022177172, end: 1716022177237)
15:49:39.865 [info] Cell 2 completed in 2.623s (start: 1716022177242, end: 1716022179865)

Coding Language and Runtime Version

Python 3.11.6

Running Jupyter locally or remotely?

Remote

@movy movy added the bug Issue identified by VS Code Team member as probable bug label May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants