question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python Interactive session hangs when running k3d polt cell (IPyWidget problem)

See original GitHub issue

Environment data

  • VS Code version: 1.34.0
  • Extension version (available under the Extensions sidebar): 2019.5.17517
  • OS and version: Windows 10.0.16299
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Relevant/affected Python packages and their versions: K3D 2.6.5, Jupyter Notebook 5.7.8

Expected behaviour

Entering the following python code in an empty .py file in vscode, and clicking the “Run Cell” code lens should launch the Python Interactive session, run the code, and display the output as a 3D plot that you can interact with.

Or, at worst, display a message that the output format is not supported if that is the case.

#%%
import k3d
plot = k3d.plot()

vertices = [[0, 0, 0], [0, 0, 1], [1, 0, 0]]
indices = [[0, 1, 2]]

mesh = k3d.mesh(vertices, indices)

plot += mesh

plot.display()

Actual behaviour

Python Interactive session is created, the Jupyter server is running, the code cell appears and it looks like it is running (moving wait indicator thingy animates) but it looks like the server never returns, and vscode never times out. The indicator just keeps animating.

While this is happening it is possible to connect to the same Jupyter server (cut and paste the URL from vscode into a browser window) and run the code in an interactive session there. In the browser, the code runs and displays the plot almost instantly, meanwhile vscode remains hung.

Steps to reproduce:

  1. Ensure that jupyter and k3d-jupyter are installed (for k3d see installation section here: https://github.com/K3D-tools/K3D-jupyter it’s in pip and conda).
  2. Create a new empty .py file
  3. Cut and paste the python code above
  4. Click the Run Cell code lense

Logs

Jupyter Server URI: http://localhost:8889/?token=99e4d40e2669837d10c9e27cc1dc7e3e2cc72d06b0f523b9
Python version:
3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]
C:\\Python37\\python.exe
Jupyter Notebook Version: (5, 7, 8)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rchiodocommented, Jun 5, 2019

Number 2. We don’t currently support any ipywidgets.

0reactions
RossBencinacommented, Jun 7, 2019

@greazer I don’t think it’s an exact dupe. The issue is not just supporting ipywidgets, but that in the case of this issue Python Interactive hangs. Other ipywidgets do not exhibit this behavior, for example pythreejs just doesn’t output anything, or outputs the textual representation of the output, which is what you’d expect. I described that behavior in more detail here: https://github.com/K3D-tools/K3D-jupyter/issues/157#issuecomment-498627114

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Interactive session hangs when running k3d polt cell ...
This is an ipywidgets bug. There's a comm error trying to communicate with the K3D ipywidget. Similar to: https://github.com/microsoft/vscode- ...
Read more >
IPython Notebook ipywidgets does not show - Stack Overflow
No error messages appear. The code seem to run just fine, as the table appears, but the slide bar just doesn't appear. I...
Read more >
Jupyter on the HPC Clusters - Princeton Research Computing
To begin a session, click on "Interactive Apps" and then "Jupyter" (or ... Jupyter sessions run on the compute nodes which do not...
Read more >
Overview — K3D-jupyter documentation
K3D -jupyter plots ipywidgets assuring a perfect interaction of a browser-side widget with Python kernel by a proven and standardized protocol.
Read more >
ipywidgets | Databricks on AWS
You can use ipywidgets to make your Databricks Python notebooks interactive. The ipywidgets package includes over 30 different controls, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found