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

Some interactive jupyter widgets unusable slow with the Python plugin + Remote-SSH plugin #121519

Closed
tjahn opened this issue Apr 16, 2021 · 6 comments
Assignees

Comments

@tjahn
Copy link

tjahn commented Apr 16, 2021

Hello,

I am experiencing some really laggy interactive jupyter widgets when using the Remote-SSH extension.

The following python code creates an interactive jupyter widget in vscode showing a 3d Sphere rendered on the server and streamed to the jupyter widget:

# %%
import pyvista as pv
pv.start_xvfb() #if X11 DISPLAY is available on the server you may remove this line
sphere = pv.Sphere()
plotter = pv.Plotter(notebook=True)
plotter.add_mesh(sphere)
plotter.show(use_ipyvtk=True)

The interactive jupyter widget is visible but unusable laggy when running this code on a remote Server using the SSH-Extension.

I expected that the Python extension starts a jupyter server on the remote host, forwards the port to my local working machine and connects the interactive python tab to this port. However, this doesn't seem to be correct, since everything is working fine when I do this manually:

  • If I use a local vscode project and let the python extension start the default jupyter server, everything is working fine.
  • If I use a local vscode project and connect to an existing jupyter lab running on the remote Server (by forwarding a local port to the remote server "ssh -L 8888:remoteServer:8888 remoteServer"), everything is working fine.
  • If I use the Remote-SSH plugin to connect to the server and then connect to the same existing jupyter lab, the widget is unusable laggy.
  • If I use the Remote-SSH plugin and let the jupyter extension start its own default jupyter host, the widget is unusable laggy

Steps to Reproduce:

  1. python3 -m pip install pyvista vtk
  2. Connect to remote OpenSuse Server using the Remote-SSH plugin
  3. Run the code interactively
  4. Try using the mouse to interacting with the sphere

My system information:

vscode : 1.55.2
OS: MacOS 11.2.3
Remote OS: OpenSuse 15.2 Leap
pyvista : 0.29.1
IPython : 7.16.1
ipyvtk_simple : 0.1.4
@roblourens
Copy link
Member

roblourens commented Apr 19, 2021

I guess the difference is just whether the extension host is running remotely, but I guess this is just due to the latency between your host and remote? Can you explain what aspect of it is laggy? Don't know about this scenario in particular, but there can be some code running locally, some in the EH, some in the kernel.

@tjahn
Copy link
Author

tjahn commented Apr 20, 2021

When I use the mouse to interact with the window it takes 5-15 seconds to move. Also when it starts, it only renders with roughly 1 fps.

@tjahn
Copy link
Author

tjahn commented Apr 20, 2021

I noticed the same problem with matplotlib. I installed ipympl with pip and then used "%matplotlib inline" to get an interactive window in vscode. Again its working fine on a local project.

# %%
import numpy as np
import matplotlib.pyplot as plt
%matplotlib widget

# %%
plt.plot( np.sin(np.linspace(0,100,1000)) )

@roblourens
Copy link
Member

Could there just be high latency between your local machine and remote?

@tjahn
Copy link
Author

tjahn commented Apr 20, 2021

Wouldnt it have been slow too when I connect to an existing jupyter kernel from a local vscode project in that case?

I didn't notice an especially high latency during my everyday work with ssh and vscode remote (without interactive plots) either.

@roblourens
Copy link
Member

roblourens commented Apr 20, 2021

It's working fine for me on a remote. You might be interested in our new native notebook experience in vscode - it may work better there. https://devblogs.microsoft.com/python/introducing-the-jupyter-extension-for-vs-code/

You can also ask this on the python repo, they are the experts of python notebooks and matplotlib widgets and can give better advice.

https://github.com/microsoft/vscode-python/issues

@github-actions github-actions bot locked and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants