Dear community, I encounter a compatibility issue when using DOLFINx, PyVista, and PyTorch together. Here is the code to reproduce the compatibility issue and I wonder how to solve it.
"""
The compatibility issue of three packages: DOLFINx, PyVista, PyTorch.
At most two lines out of commands 1–3 can coexist.
Otherwise, the code will crash with following info:
Verify if there is a pass dependency cycle.
Required Passes:
Segmentation fault
"""
from dolfinx.generation import RectangleMesh # Command 1
import torch # Command 2
import numpy as np
import pyvista
cells = np.array([4, 0, 1, 3, 2])
cell_types = np.array([9])
coord = np.array([
[0, 0, 0],
[0, 1, 0],
[1, 0, 0],
[1, 1, 0],
])
pyvista.start_xvfb(wait=0.05)
plotter = pyvista.Plotter()
grid = pyvista.UnstructuredGrid(cells, cell_types, coord)
grid.cell_data["data"] = np.array([0.5])
plotter.add_mesh(grid)
plotter.screenshot("test.jpg") # Command 3
plotter.close()