{"id":6298,"library":"vispy","title":"VisPy","description":"VisPy is a high-performance interactive 2D/3D data visualization library in Python. It leverages the computational power of modern Graphics Processing Units (GPUs) through OpenGL to display very large datasets and facilitate real-time data visualization. Currently at version 0.16.1, the library is under active development with a roadmap towards a 1.0 release, focusing on stability, performance, and higher-level interfaces for ease of use.","status":"active","version":"0.16.1","language":"en","source_language":"en","source_url":"https://github.com/vispy/vispy","tags":["visualization","opengl","gui","scientific","2d","3d","gpu","real-time"],"install":[{"cmd":"pip install vispy","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Mandatory requirement for array operations.","package":"numpy","optional":false},{"reason":"One of several optional GUI backends required to open a window and create an OpenGL context.","package":"PyQt5","optional":true},{"reason":"One of several optional GUI backends required to open a window and create an OpenGL context.","package":"PyQt6","optional":true},{"reason":"One of several optional GUI backends required to open a window and create an OpenGL context.","package":"PySide2","optional":true},{"reason":"One of several optional GUI backends required to open a window and create an OpenGL context.","package":"PySide6","optional":true},{"reason":"Required for inline visualizations in Jupyter notebooks.","package":"jupyter_rfb","optional":true},{"reason":"Optional dependency for reading image files.","package":"Pillow","optional":true}],"imports":[{"note":"Common top-level imports for creating applications and working with the scene graph.","symbol":"app, scene","correct":"from vispy import app, scene"},{"note":"For creating an interactive 3D scene canvas.","symbol":"SceneCanvas","correct":"from vispy.scene import SceneCanvas"},{"note":"For accessing high-level visual objects like Mesh, Cube, etc.","symbol":"visuals","correct":"from vispy.scene import visuals"},{"note":"For defining colors within VisPy.","symbol":"Color","correct":"from vispy.color import Color"},{"note":"For low-level OpenGL programming with VisPy's `gloo` interface. Note that `gloo` is slated for deprecation.","symbol":"gloo","correct":"from vispy import gloo"}],"quickstart":{"code":"import sys\nimport numpy as np\nfrom vispy import scene, app\nfrom vispy.color import Color\n\n# Create a canvas\ncanvas = scene.SceneCanvas(keys='interactive', size=(800, 600), show=True)\ncanvas.title = \"VisPy Cube\"\n\n# Create a viewbox\nview = canvas.central_widget.add_view()\nview.camera = 'turntable' # For 3D interaction\n\n# Create a cube visual and add to the view\ncube_mesh = scene.visuals.Cube()\nview.add(cube_mesh)\n\n# Set background color\nview.bgcolor = Color('black')\n\n# Start the event loop\nif __name__ == '__main__':\n    print(\"VisPy window opened. Close it to exit.\")\n    app.run()\n","lang":"python","description":"This example creates a simple interactive 3D cube using VisPy's high-level scene graph interface. It demonstrates how to initialize a canvas, set up a 3D camera, add a visual object, and run the VisPy application event loop."},"warnings":[{"fix":"Ensure a compatible GUI toolkit (e.g., `pip install PyQt5`) and the latest GPU drivers are installed.","message":"VisPy requires at least one GUI toolkit backend (e.g., PyQt5, PySide2, GLFW) and an up-to-date GPU driver with OpenGL 2.1+ support to function. Without these, applications may fail to run or display correctly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Combine multiple graphical elements into a single `Visual` where possible (e.g., one `LineVisual` to draw multiple lines instead of many `LineVisuals`). For complex cases, consider custom visuals with optimized shader code.","message":"Performance can degrade significantly when creating many individual `Visual` objects. VisPy internally treats each visual as a separate OpenGL program, leading to overhead.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure all drawing and update calls that interact directly with the OpenGL context or VisPy Canvas are executed on the main GUI thread. Use thread-safe mechanisms provided by the GUI backend (e.g., signals/slots in Qt) for inter-thread communication.","message":"OpenGL operations, including calls to `self.update()` on VisPy Canvas or Visual objects, must be performed on the main/GUI thread. While data updates can occur in secondary threads, the final redraw command must originate from the main thread.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Pin `vispy` to an exact version in `requirements.txt` to prevent unexpected breaking changes. Review release notes carefully when upgrading.","message":"VisPy is pre-1.0 and undergoing heavy development, meaning its internal API and behavior, especially for visuals, can change between minor versions. This has historically caused incompatibilities for applications relying on specific internal implementations.","severity":"breaking","affected_versions":"<1.0"},{"fix":"For new projects or refactoring, prioritize using the `vispy.scene` and `vispy.plot` high-level interfaces. If `gloo` is necessary, be aware of its potential deprecation and future replacement strategies.","message":"The low-level `gloo` interface and GLIR (Graphics Library Intermediate Representation) are likely to be deprecated in future versions as development shifts focus towards higher-level interfaces.","severity":"deprecated","affected_versions":"Likely >0.16.1"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}