pyvista: Plotter segfaults in for loop

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

I am iterating over meshes to show them but it throws a segfault after the second visualization. Expected behaviour: use .plot() in for loop with new window every time.

potentially an extension of #558?

Steps to reproduce the bug.

import pyvista
for i in range(3):
    pyvista.Sphere().plot()

close the window with q or the cross. Second plotting segfaults.

System Information

--------------------------------------------------------------------------------
  Date: Tue Jan 24 16:01:54 2023 CET

                OS : Linux
            CPU(s) : 36
           Machine : x86_64
      Architecture : 64bit
       Environment : Python
        GPU Vendor : Mesa/X.org
      GPU Renderer : llvmpipe (LLVM 13.0.0, 256 bits)
       GPU Version : 4.5 (Core Profile) Mesa 21.3.4

  Python 3.7.15 (default, Nov 24 2022, 21:12:53)  [GCC 11.2.0]

           pyvista : 0.37.0
               vtk : 9.2.2
             numpy : 1.20.2
           imageio : 2.22.4
            scooby : 0.7.0
             pooch : v1.6.0
        matplotlib : 3.5.3
             scipy : 1.6.2
              tqdm : 4.64.1
            meshio : 4.4.6
--------------------------------------------------------------------------------

Screenshots

No response

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 3
  • Comments: 21 (14 by maintainers)

Most upvoted comments

Hi, I have the same issue,

	deformed_obj_mesh = pv.read(obj_write_dir)
	p = pv.Plotter()
	print(pv.Report())
	p.add_mesh(deformed_obj_mesh,show_edges=True)
	p.add_title(title)
	p.camera.position = (0, 3.0, -2)
	p.camera.azimuth = 0
	p.camera.elevation = 0
	p.show()
	p.close()

After the second plot of pyvista sometimes I have : Segmentation fault (core dumped)

Info:


--------------------------------------------------------------------------------
  Date: Sun Feb 05 16:55:18 2023 IST

                OS : Linux
            CPU(s) : 20
           Machine : x86_64
      Architecture : 64bit
               RAM : 62.6 GiB
       Environment : Python
       File system : ext4
        GPU Vendor : NVIDIA Corporation
      GPU Renderer : NVIDIA RTX A6000/PCIe/SSE2
       GPU Version : 4.5.0 NVIDIA 520.61.05

  Python 3.9.15 | packaged by conda-forge | (main, Nov 22 2022, 15:55:03)
  [GCC 10.4.0]

           pyvista : 0.37.0
               vtk : 9.2.5
             numpy : 1.24.1
           imageio : 2.25.0
            scooby : 0.7.1
             pooch : v1.6.0
        matplotlib : 3.6.3
           IPython : 8.8.0
             scipy : 1.10.0
              tqdm : 4.64.1
            meshio : 5.3.4
         pythreejs : 2.4.1

@bjlittle, thanks for also reporting on this! I’ll see what I can do to continue to look into this

9.2.3-4 are the same as 9.2.5 (there was a minor bug in 9.2.4 that we patched in 9.2.5). Actually, 9.2.3-4 are being yanked from PyPI

@banesullivan Don’t know if this issue is related to the destruction of one render window and the creation of the next…

If you want me to try anything at this end, then please advise and I’ll run anything you suggest that might help diagnose the root cause 👍

I downgraded to vtk==9.1 and the issue went away with both versions of pyvista 0.36.1 and 0.38.dev0.

I am also running into this same issue. Here is my pv.Report() output:

--------------------------------------------------------------------------------
  Date: Mon Jan 30 09:28:37 2023 MST

                OS : Linux
            CPU(s) : 16
           Machine : x86_64
      Architecture : 64bit
               RAM : 30.1 GiB
       Environment : IPython
       File system : ext4
        GPU Vendor : AMD
      GPU Renderer : AMD YELLOW_CARP (LLVM 13.0.1, DRM 3.42, 5.15.0-58-generic)
       GPU Version : 4.6 (Core Profile) Mesa 22.0.5

  Python 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:58:50)
  [GCC 10.3.0]

           pyvista : 0.36.1
               vtk : 9.2.5
             numpy : 1.23.5
           imageio : 2.25.0
           appdirs : 1.4.4
            scooby : 0.7.1
        matplotlib : 3.6.3
           IPython : 8.9.0
        ipyvtklink : 0.2.3
             scipy : 1.10.0
              tqdm : 4.64.1
        jupyterlab : 3.5.3
--------------------------------------------------------------------------------

I will try installing from the fix/show-returns branch to see if that helps.

Sorry, I missed the upper part when copying. I updated the original post.