{"id":4843,"library":"viser","title":"viser: 3D Visualization for Computer Vision and Robotics","description":"Viser is a Python library designed for interactive 3D visualization, primarily targeting applications in computer vision and robotics. It provides a rich API for visualizing 3D primitives and constructing interactive GUI elements, all delivered through a responsive, web-based client that enables easy use over SSH and in Jupyter notebooks. The library is actively maintained with frequent releases, currently at version 1.0.26.","status":"active","version":"1.0.26","language":"en","source_language":"en","source_url":"https://github.com/viser-project/viser","tags":["3d","visualization","robotics","computer-vision","web-ui","realtime","gui"],"install":[{"cmd":"pip install viser","lang":"bash","label":"Install core library"},{"cmd":"pip install \"viser[examples]\"","lang":"bash","label":"Install with example dependencies"}],"dependencies":[{"reason":"Required Python version.","package":"python","optional":false}],"imports":[{"note":"This is the main class for instantiating the visualization server.","symbol":"ViserServer","correct":"from viser import ViserServer"}],"quickstart":{"code":"import time\nimport numpy as np\nfrom viser import ViserServer\n\n# Create a Viser server\nserver = ViserServer(port=8080, label='My Viser App')\nprint(f\"Viser server started at: http://localhost:{server.get_port()}\")\n\n# Add a red sphere to the scene\nserver.scene.add_sphere(\n    name=\"/my_sphere\",\n    position=(0.0, 0.0, 0.0),\n    radius=0.5,\n    color=(1.0, 0.0, 0.0)\n)\n\n# Add a simple GUI slider to control sphere's X position\nx_position_slider = server.gui.add_slider(\n    name=\"Sphere X Position\",\n    min=-2.0,\n    max=2.0,\n    step=0.1,\n    initial_value=0.0\n)\n\n@x_position_slider.on_update\ndef _(field):\n    current_position = list(server.scene[\"/my_sphere\"].position)\n    current_position[0] = field.value\n    server.scene[\"/my_sphere\"].position = tuple(current_position)\n\n# Keep the server running indefinitely\nserver.sleep_forever()","lang":"python","description":"This quickstart code initializes a Viser server, adds a red sphere to the 3D scene, and includes a GUI slider to interactively control the sphere's X-axis position. Access the visualization by navigating to the printed URL in your web browser."},"warnings":[{"fix":"Instead of `handle.position[0] += 0.1`, use `new_pos = list(handle.position); new_pos[0] += 0.1; handle.position = tuple(new_pos)` (or similar explicit reassignment with `numpy` arrays).","message":"When updating properties of `SceneNodeHandles` (e.g., position, orientation), explicit reassignment of the entire property is required, especially when modifying NumPy arrays in-place. Direct in-place modification of array elements might not trigger updates to the client for versions `0.2.10` and later.","severity":"breaking","affected_versions":">=0.2.10"},{"fix":"Ensure that your `viser` Python package version matches the client version it attempts to serve. If manually hosting a client, ensure it's built from a compatible `viser` source.","message":"Viser enforces strict version compatibility between the Python backend and the web client. If the client (served by the browser) and the Python server versions do not match, the connection will be rejected with a protocol error (code 1002). This is a security and stability feature to prevent mismatched functionality.","severity":"gotcha","affected_versions":"All versions"},{"fix":"This is an environment-specific issue. Potential workarounds include ensuring the Windows registry correctly associates `.js` files with `text/javascript` MIME type, or trying different web browsers.","message":"On some Windows systems, users have reported issues where the Viser web client fails to load due to a 'Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of \"text/plain\"' error. This is often caused by missing or incorrect `.js` MIME type definitions in the Windows registry.","severity":"gotcha","affected_versions":"Potentially all versions on affected Windows environments"},{"fix":"Optimize your data updates to minimize frequency and size where possible. For purely static scene exports without interactivity, consider using `server.get_scene_serializer().serialize()` to save the scene state to a `.viser` file.","message":"Viser's API is inherently stateful, and all data transfers between the Python server and the web client occur over a WebSocket connection. This can introduce network overhead, especially for frequent, high-bandwidth updates or complex user interactions requiring round-trip communication. Static web page exports with full interactivity are not directly supported.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}