Jupyter over remote ssh sometimes becomes slow and/or unresponsive
See original GitHub issueEnvironment data
- VS Code version: 1.62.3 (Universal)
- Jupyter Extension version (available under the Extensions sidebar): v2021.10.1101450599
- Python Extension version (available under the Extensions sidebar): v2021.11.1422169775
- OS (Windows | Mac | Linux distro) and version: Mac
- Python and/or Anaconda version: 3.7.12
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
- Jupyter server running: Remote
Expected behaviour
I expect code cells to begin executing immediately and (for simple code snippets) to finish executing immediately (e.g. print(‘hello’))
Actual behaviour
Once the jupyter notebook starts to contain a non-trivial amount of stuff, I start to observe the following behaviors: (1) code cells that contain simple tasks (e.g. print('hello')
) start taking several seconds or more to complete, (2) it may take several seconds or even minutes for vscode to even visually show that it will start executing a code cell, and (3) in severe cases, the whole vscode editor will become unresponsive and I will need to force shut it down.
Steps to reproduce:
Below is code for a jupyter notebook that contains a minimal example. The problems start to appear once you’ve cycled through the code cells 2 or 3 times. I think one of the main contributing factors to this issue are just notebooks that have a lot of “stuff” in them. To demonstrate that, the last code block prints 50 scatter plots as pngs, which the native jupyter lab server over the browser handles just fine… but vscode seems to have issues. Moreover, in this simple example I have observed instances where it starts to take a while to save the notebook and the editor may even become unresponsive.
Other things to note:
- I am running this jupyter notebook on an AWS EC2 instance with ~90GB memory 48 CPUs (using a AWS linux ami:
ami-083ac7c7ecf9bb9b0
). - I have not yet observed these same issues when I have the kernel running on my local mac machine.
Jupyter example
# %%
# %load_ext autoreload
# %autoreload 2
import pandas as pd
import plotly.express as px
import numpy as np
import plotly.io as pio
pio.renderers.default='jupyterlab+notebook'
pd.set_option("display.max_columns", 20)
# %%
data = pd.DataFrame(np.random.random(size=(1000,1000)))
# %%
data
# %%
print('hello')
# %%
for i in range(50):
fig = px.scatter(x=data[i], y=data[i+1])
fig.show(renderer='png')
Logs
Here is a screenshot where it takes almost 3 seconds for a simple print statement. I’ve seen worse in some of my code related to real projects, though. This is just what I was able to reproduce with a minimal example.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:26
- Comments:31 (6 by maintainers)
Top GitHub Comments
I also experience the same. I observed that:
I hope these may help diagnose the problem.
Also having this issue with jupyter over ssh, in a notebook that has a decent number of plots.