{"id":4227,"library":"pyvista","title":"PyVista","description":"PyVista is a high-level Pythonic interface to the Visualization Toolkit (VTK), simplifying 3D plotting, mesh data structures, and filtering methods for spatial datasets. It is an active project, currently at version 0.47.3, with frequent patch releases and minor versions addressing bugs and introducing new features.","status":"active","version":"0.47.3","language":"python","source_language":"en","source_url":"https://github.com/pyvista/pyvista","tags":["3D visualization","VTK","meshing","plotting","scientific computing"],"install":[{"cmd":"pip install pyvista","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"PyVista directly inherits types from the VTK library, serving as its core 3D visualization backend.","package":"vtk"},{"reason":"Provides the core foundation for PyVista's data array access and manipulation.","package":"numpy"},{"reason":"Used for colormaps and 2D plotting functionalities.","package":"matplotlib"},{"reason":"Used for saving screenshots of plots.","package":"pillow"},{"reason":"Used for reading images and writing animations.","package":"imageio"},{"reason":"Manages the download and caching of example datasets.","package":"pooch"},{"reason":"Provides tools for reporting and debugging the PyVista environment.","package":"scooby"},{"reason":"Used for client and server-side rendering in Jupyter environments.","package":"trame","optional":true},{"reason":"Enables input/output for a wide variety of mesh file formats.","package":"meshio","optional":true}],"imports":[{"note":"The convention is to import PyVista as `pv` for brevity and consistency.","symbol":"pyvista","correct":"import pyvista as pv"},{"note":"Commonly used to access built-in example datasets and functions for quick demonstrations.","symbol":"examples","correct":"from pyvista import examples"}],"quickstart":{"code":"import pyvista as pv\nfrom pyvista import examples\n\n# Download and load an example mesh (e.g., the Stanford dragon)\nmesh = examples.download_dragon()\n\n# Add scalar data based on point coordinates for coloring\nmesh['scalars'] = mesh.points[:, 1]\n\n# Create a plotter and add the mesh\nplotter = pv.Plotter()\nplotter.add_mesh(mesh, cmap='plasma', show_edges=True)\n\n# Set the camera position and display the plot\nplotter.show(cpos='xy')\n","lang":"python","description":"This example demonstrates how to download a sample 3D mesh, assign scalar data to its points for coloring, and then visualize it using PyVista's `Plotter` with a specified colormap and camera position."},"warnings":[{"fix":"To obtain image depth after the plotter closes, you must explicitly enable `store_image_depth=True` in the `show()` method (e.g., `plotter.show(store_image_depth=True)`).","message":"The behavior of `Plotter.show()` regarding image depth storage changed in v0.47. It no longer automatically stores the last image depth.","severity":"breaking","affected_versions":">=0.47.0"},{"fix":"In v0.46.0 and v0.46.1, you had to use `pyvista.set_new_attribute(obj, name, value)`. In v0.46.3+, this was relaxed: new *public* attributes still require `set_new_attribute()`, but *private* attributes (prefixed with `_`) can be set directly.","message":"Setting new attributes on PyVista classes was restricted starting from v0.46.0.","severity":"breaking","affected_versions":"0.46.0 - 0.46.2"},{"fix":"Upgrade to PyVista v0.46.4 or later, which re-enabled the caching mechanism and resolved the performance degradation.","message":"Performance of `mesh.ray_trace` was significantly slower in versions 0.46.0 to 0.46.3 due to the removal of `obbTree` caching.","severity":"gotcha","affected_versions":"0.46.0 - 0.46.3"},{"fix":"Use the `DataSetAttributes.get_array(index)` method instead of the `[]` operator for integer indexing. String-based access (`obj['array_name']`) remains valid.","message":"Accessing arrays in `DataSetAttributes` (e.g., `mesh.point_data` or `mesh.cell_data`) using integer indexing (`obj[index]`) is deprecated.","severity":"deprecated","affected_versions":">=0.32.0"}],"env_vars":null,"search_vec":"'0.47.3':35 '3d':16,49 'activ':30 'address':43 'bug':44 'comput':55 'current':32 'data':19 'dataset':26 'featur':48 'filter':22 'frequent':37 'high':6 'high-level':5 'interfac':9 'introduc':46 'level':7 'mesh':18,52 'method':23 'minor':41 'new':47 'patch':38 'plot':17,53 'project':31 'python':8 'pyvista':1,2 'releas':39 'scientif':54 'simplifi':15 'spatial':25 'structur':20 'toolkit':13 'version':34,42 'visual':12,50 'vtk':14,51","created_at":"2026-04-12T03:46:22.719609+00:00","updated_at":"2026-04-17T15:07:33.174579+00:00","problems":[{"fix":"Install PyVista using pip: `pip install pyvista`","cause":"The PyVista library is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'pyvista'"},{"fix":"Enable off-screen rendering by setting `pyvista.OFF_SCREEN = True` before any plotting, and ensure an appropriate off-screen VTK backend (like `osmesa` or `egl`) is available, or use `xvfb`. Example: `import pyvista; pyvista.OFF_SCREEN = True; # your plotting code`","cause":"PyVista attempts to create a rendering window on a system without a graphical display (e.g., a server or container), and the default VTK backend cannot find an X server.","error":"failed to get the display"},{"fix":"Replace `mesh.scalars` with `mesh.active_scalars` to access the active scalar array. Example: `mesh.active_scalars`","cause":"The `mesh.scalars` attribute was deprecated in PyVista versions >0.30 in favor of `mesh.active_scalars` for retrieving the currently active scalar array.","error":"AttributeError: 'PolyData' object has no attribute 'scalars'"},{"fix":"Choose one of the valid backend names from the error message. Example: `pyvista.set_jupyter_backend('ipyvtk_simple')`","cause":"An invalid or unsupported backend name was provided when attempting to set the PyVista Jupyter backend.","error":"ValueError: 'your_backend_name' is not a valid backend. Options are: ['ipyvtk_simple', 'panel', 'client', 'server', 'trame']"},{"fix":"Use the PyVista-style method: `plotter.add_actor(...)`","cause":"The user is attempting to use a VTK-style method name (e.g., `AddActor` with capital 'A') on a PyVista `Plotter` object, whereas PyVista uses Pythonic, lowercase method names.","error":"AttributeError: 'pyvista.Plotter' object has no attribute 'AddActor'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.48.4","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/pyvista/pyvista","docs":"https://docs.pyvista.org/","changelog":null,"pypi":"https://pypi.org/project/pyvista/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-28","install_tag":null}}