pyvista / pyvistaqt

Qt support for PyVista
http://qtdocs.pyvista.org
MIT License
111 stars 19 forks source link

BackgroundPlotter segfaults on MacOS when smooth_shading is True #18

Open GuillaumeFavelier opened 4 years ago

GuillaumeFavelier commented 4 years ago

The following snippet fails on MacOS:

import numpy as np
import pyvista as pv
from pyvistaqt import BackgroundPlotter
import vtk
p = BackgroundPlotter()
# sphere
center = np.random.rand(200, 3) * 1000 - 500
sphere = vtk.vtkSphereSource()
sphere.SetThetaResolution(8)
sphere.SetPhiResolution(8)
sphere.SetRadius(10)
sphere.Update()
geom = sphere.GetOutput()
mesh = pv.PolyData(np.array(center))
glyph = mesh.glyph(orient=False, scale=False,
                   factor=1.0, geom=geom)
p.add_mesh(glyph, smooth_shading=True)

And in my experience, adding p.app.processEvents() just before add_mesh() fixes it.

@agramfort feel free to confirm this and share your report when possible:

python -c "import pyvista; print(pyvista.Report())"
agramfort commented 4 years ago

I confirm that this gives me a segfault on my mac.

$ python -c "import pyvista; print(pyvista.Report())"

--------------------------------------------------------------------------------
  Date: Wed Jun 24 17:00:43 2020 CEST

                OS : Darwin
            CPU(s) : 16
           Machine : x86_64
      Architecture : 64bit
               RAM : 32.0 GB
       Environment : Python
        GPU Vendor : ATI Technologies Inc.
      GPU Renderer : AMD Radeon Pro 5500M OpenGL Engine
       GPU Version : 4.1 ATI-3.2.32

  Python 3.7.5 (default, Oct 25 2019, 10:52:18)  [Clang 4.0.1
  (tags/RELEASE_401/final)]

           pyvista : 0.25.3
               vtk : 8.2.0
             numpy : 1.17.4
           imageio : 2.6.1
           appdirs : 1.4.3
            scooby : 0.5.2
            meshio : 4.0.15
        matplotlib : 3.2.1
         pyvistaqt : 0.1.0
             PyQt5 : 5.13.2
           IPython : 7.13.0
             scipy : 1.4.1
              tqdm : 4.43.0

  Intel(R) Math Kernel Library Version 2019.0.4 Product Build 20190411 for
  Intel(R) 64 architecture applications
--------------------------------------------------------------------------------