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.

VTK seems to break interactive window

See original GitHub issue

This example requires pip install pymatgen vtk. VTK is the Visualization Toolkit which offers 1st party Python bindings.

# %%
from pymatgen.core import Structure
from pymatgen.vis.structure_vtk import StructureVis


# %%
struct = Structure(
    [[1, 0, 0], [0, 1, 0], [0, 0, 1]],
    ["O", "H", "H"],
    [[0, 0, 0], [0.5, 0.5, 0], [0.5, 0, 0.5]],
)

# %%
struct_vis = StructureVis()
struct_vis.set_structure(struct)
struct_vis.show()


# %%
print("hello")

Two odd things here:

  1. The interactive crystal structure created by struct_vis.show() opens in a new Python window, i.e. is not captured by VS Code Jupyter and inlined into the notebook. Screenshot below. Screen Shot 2021-11-26 at 12 52 14

  2. When closing the Python window, I get a beach ball spinning endlessly until I force close Python.app and from then on, my interactive window is broken. Running any cell (e.g. print("hello")) now throws

    Error: Session cannot generate requests
    at S.executeCodeCell (/Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2021.10.1101450599/out/client/extension.js:66:301742)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at S.execute (/Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2021.10.1101450599/out/client/extension.js:66:300721)
    

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
DonJayamannecommented, Dec 1, 2021

Same problem in Insiders. I still get a beach ball when trying to close the Python plot window.

PLease could you provide the logs from the Jupyter output panel. Looks like the kernel is dying. Also can you try this in Jupyter Notebook (outside vscode) and confirm the kernel doesn’t die there either.

Basically I don’t think this is a problem with VS Code, we don’t kill the kernel, here it looks like the kernel died for some external reason.

0reactions
janoshcommented, Dec 2, 2021

@DonJayamanne You’re right, same thing happening in Jupyter. Closing as unrelated to VS Code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

QVTKOpenGLWidget does not stop interaction in leaveEvent()
Tested with vtkInteractorStyleTrackballCamera. After QVTKOpenGLWidget is displayed: Push the left mouse button over renderer window.
Read more >
Crash when starting vtkRenderer - Support - VTK Discourse
Hello, I am working on a program which computes a particular polynomial in the complex plane, then uses VTK to make a colorized...
Read more >
Vtk charts break in QT, "no override found for ... - Stack Overflow
find_package(VTK COMPONENTS vtkChartsCore vtkCommonCore vtkCommonDataModel vtkInteractionStyle ... It seems I missed some libraries.
Read more >
VTK: A Powerful Open Source Data Visualization Tool - Toptal
3D Data Visualization With Open Source Tools: A Tutorial Using VTK ... Render and show interactive window renWin->Render(); interact->Initialize(); ...
Read more >
Introduction to Python and VTK - Centre for Image Analysis
and VTK. Scientific Visualization, HT 2014. Lecture 2. Johan Nysjö. Centre for Image analysis. Swedish University of Agricultural Sciences.
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