Skip to content

VPython hangs in Jupyter notebook inside VS Code #281

Description

@ruboerner

When running VPython inside a Jupyter notebook in VS Code, the code hangs indefinitely.

Minimal working example:

from vpython import *
sphere()

Expected behavior:
A 3D canvas should open and display a sphere.

Actual behavior:
The line with sphere() runs forever without producing output. No error message appears.

Environment:

  • Python version: 3.12.6
  • vpython version: 7.6.5
  • jupyterlab-vpython extension version: 3.1.8
  • OS: MacOS
  • VS Code version: 1.103.2

Additional info:

  • The same code works correctly when run as a standalone Python script in VS Code.
  • The same code works in Jupyterlab outside of VS Code.

Activity

  1. sspickle commented on Aug 16, 2026

    @sspickle
    Contributor

    Two-part answer to this issue is underway:

    1. The silent hang is fixed in Fail loudly instead of hanging forever when no frontend connects (#281) #292: import vpython now fails after 30s with a clear error naming the environment (VS Code detected via its env vars) and pointing at what works, instead of hanging the kernel forever. VPYTHON_CONNECT_TIMEOUT raises the limit for genuinely slow first-runs.

    2. Actual VS Code support is being designed: a VS Code extension using the Notebook Renderer API + Jupyter kernel comm messaging (the mechanism ipywidgets uses), rendering through the same host-agnostic glowcomm_host.js frontend recently factored out on the pyodide-packaging branch (Pyodide/wasm support: pure-Python wheel, worker transport, GlowScript host factory #291). No timeline promised yet, but the hang at least stops being silent now.

    🤖 Generated with Claude Code

  2. added a commit that references this issue on Aug 16, 2026
  3. sspickle commented on Aug 16, 2026

    @sspickle
    Contributor

    Update: VPython scenes now render live in VS Code notebooks — working prototype, end to end. Objects, rate() animation, zoom/orbit, text() fonts, and textures all verified.

    Two pieces:

    With the extension absent, import vpython fails loudly per #292 instead of hanging. Remote kernels (WSL/SSH/Codespaces) are the main known gap — needs the extension to ask VS Code for port forwarding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions