pyvista / pyvista

3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK)
https://docs.pyvista.org
MIT License
2.62k stars 482 forks source link

[BUG] Segmentation fault (SIGSEGV) on Ubuntu when calling pyvista.plot() #4273

Open DylanWaken opened 1 year ago

DylanWaken commented 1 year ago

Describe the bug, what's wrong, and what you expected.

When trying to use pyvista.plot(<mesh>) anywhere in the code, it would produce the following message:

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

The error is cause by line 418 of file renderer.py in pyvista base code, where:

for actor in self._actors.values():                           # line 418
    if isinstance(actor, (_vtk.vtkCubeAxesActor, _vtk.vtkLightActor)):   
        continue

The location of error reported by ubuntu gdb is given as:

0x00007fff4b595bf0 in vtkAOSDataArrayTemplate<double>::GetTuple(long long) () from /home/dylan/.local/lib/python3.10/site-packages/vtkmodules/libvtkCommonCore-9.2.so

Please fix, thanks, the library is unusable for me right now

Steps to reproduce the bug.

# create a mesh object
# vertices are 3d ndarrays for vertices, faces are 3d ndarrays for faces
mesh = pv.PolyData(vertices, faces)
pv.plot(mesh)

System Information

/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.16.0-unknown is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.16.0-unknown is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(

--------------------------------------------------------------------------------
  Date: Thu Apr 13 21:48:48 2023 PDT

                OS : Linux
            CPU(s) : 32
           Machine : x86_64
      Architecture : 64bit
               RAM : 62.5 GiB
       Environment : Python
       File system : ext4
        GPU Vendor : NVIDIA Corporation
      GPU Renderer : NVIDIA RTX 6000 Ada Generation/PCIe/SSE2
       GPU Version : 4.5.0 NVIDIA 525.85.05

  Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]

           pyvista : 0.38.5
               vtk : 9.2.6
             numpy : 1.24.1
           imageio : 2.25.0
            scooby : 0.7.1
             pooch : v1.7.0
        matplotlib : 3.6.3
           IPython : 8.9.0
        ipywidgets : 8.0.4
             scipy : 1.10.0
              tqdm : 4.64.1
      nest_asyncio : 1.5.6
--------------------------------------------------------------------------------

Screenshots

No response

DylanWaken commented 1 year ago

Running the example code will result in the same issue:

from pyvista import examples
mesh = examples.download_st_helens()
warped = mesh.warp_by_scalar('Elevation')
surf = warped.extract_surface().triangulate()
surf = surf.decimate_pro(0.75)  # reduce the density of the mesh by 75%
surf.plot(cmap='gist_earth')