Run paraview in Github Actions

Hi all,

Recently I’ve been trying to automate my workflow.
Everything works fine locally, now I would like to run paraview in a github action.

visualisation.py

from paraview.simple import *

ss = Sphere(Radius=2, ThetaResolution=32)
shr = Shrink(Input=ss)
cs = Cone()
app = AppendDatasets()
app.Input = [shr, cs]
Show(app)
Render()

SaveScreenshot("out.png", OverrideColorPalette="WhiteBackground")
name: Run FESTIM scripts

on: pull_request

jobs:
  run-gallery-monoblock:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v4

    - name: Set up Paraview Conda env
      uses: conda-incubator/setup-miniconda@v2
      with:
        activate-environment: paraview
        miniforge-version: latest
        use-mamba: true
        channels: conda-forge

    - name: Install paraview
      shell: bash -l {0}
      run: mamba install -c conda-forge paraview
    
    - name: Run paraview
      shell: bash -l {0}
      working-directory: ./gallery/monoblock
      run: pvpython --force-offscreen-rendering visualisation.py

Unfortunately this is the error message I obtain:

Run pvpython --force-offscreen-rendering visualisation.py
(   2.253s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system
(   2.253s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system
(   2.253s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system
(   2.255s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system
(   2.255s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system
(   2.255s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system
(   2.255s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system
(   2.255s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system
(   2.255s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system
(   2.270s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system
(   2.270s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system
(   2.270s) [paraview        ]            vtkMath.cxx:1374  WARN| Unable to factor linear system

Loguru caught a signal: SIGSEGV
Stack trace:
30      0x55f9dc723149 pvpython(+0x3149) [0x55f9dc723149]
29      0x7ff1b5629e40 __libc_start_main + 128
28      0x7ff1b5629d90 /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7ff1b5629d90]
27      0x55f9dc723840 pvpython(+0x3840) [0x55f9dc723840]
26      0x7ff1b5898cdc vtkPythonInterpreter::PyMain(int, char**) + 668
25      0x7ff1b370caa1 Py_RunMain + 769
24      0x7ff1b3713074 _PyRun_AnyFileObject + 68
23      0x7ff1b371333e _PyRun_SimpleFileObject + 446
22      0x7ff1b3713ae0 /usr/share/miniconda33/envs/paraview/bin/../lib/libpython3.12.so.1.0(+0x313ae0) [0x7ff1b3713ae0]
21      0x7ff1b36fc58b /usr/share/miniconda33/envs/paraview/bin/../lib/libpython3.12.so.1.0(+0x2fc58b) [0x7ff1b36fc58b]
20      0x7ff1b37014d7 /usr/share/miniconda33/envs/paraview/bin/../lib/libpython3.12.so.1.0(+0x3014d7) [0x7ff1b37014d7]
19      0x7ff1b36dd57e PyEval_EvalCode + 174
18      0x7ff1b3512bdd /usr/share/miniconda33/envs/paraview/bin/../lib/libpython3.12.so.1.0(+0x112bdd) [0x7ff1b3512bdd]
17      0x7ff1b3648845 _PyObject_Call + 181
16      0x7ff1b36341b8 /usr/share/miniconda33/envs/paraview/bin/../lib/libpython3.12.so.1.0(+0x2341b8) [0x7ff1b36341b8]
15      0x7ff1a4dd70ad /usr/share/miniconda33/envs/paraview/lib/python3.12/site-packages/paraview/modules/vtkRemotingViews.so(+0x1d70ad) [0x7ff1a4dd70ad]
14      0x7ff1b1ea36eb vtkSMViewProxy::StillRender() + 379
13      0x7ff1b3ccdc85 vtkPVSessionBase::ExecuteStream(unsigned int, vtkClientServerStream const&, bool) + 53
12      0x7ff1b3cd02b7 vtkPVSessionCore::ExecuteStreamInternal(vtkClientServerStream const&, bool) + 263
11      0x7ff1ae0c43be vtkClientServerInterpreter::ProcessStream(vtkClientServerStream const&) + 30
10      0x7ff1ae0c3ed4 vtkClientServerInterpreter::ProcessOneMessage(vtkClientServerStream const&, int) + 196
9       0x7ff1ae0c3db7 vtkClientServerInterpreter::ProcessCommandInvoke(vtkClientServerStream const&, int) + 1319
8       0x7ff1b440a9c1 vtkPVRenderViewCommand(vtkClientServerInterpreter*, vtkObjectBase*, char const*, vtkClientServerStream const&, vtkClientServerStream&, void*) + 6913
7       0x7ff1b1de5ac6 vtkPVRenderView::StillRender() + 118
6       0x7ff1b1df2ba9 vtkPVRenderView::Render(bool, bool) + 2345
5       0x7ff1af607784 vtkXOpenGLRenderWindow::Render() + 52
4       0x7ff1af55b792 vtkOpenGLRenderWindow::Render() + 194
3       0x7ff1ae767740 vtkRenderWindow::Render() + 624
2       0x7ff1af7d37ed vtkXRenderWindowInteractor::Initialize() + 237
1       0x7ff1abcfc029 XSync + 25
0       0x7ff1b5642520 /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7ff1b5642520]
(   3.800s) [paraview        ]                       :0     FATL| Signal: SIGSEGV
/home/runner/work/_temp/6254c3b8-ace8-4b9c-8f07-ea85e716c3ba.sh: line 1:  4265 Segmentation fault      (core dumped) pvpython --force-offscreen-rendering visualisation.py

Any idea? From the error message I’m guessing maybe a rendering issue even though I tried deactivating it…

Thanks in advance!

It looks like you do not have an X server running. I imagine you want either an EGL or OSMesa build of ParaView.

I see.

Do you reckon I can simply download the paraview binaries in the action then?

I don’t see why not.

Thanks! This yml file works just fine

    - name: Install paraview
      shell: bash
      run: |
        wget -O Paraview-5.11.2-osmesa-MPI-Linux-Python3.9-x86_64.tar.gz "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v5.11&type=binary&os=Linux&downloadFile=ParaView-5.11.2-osmesa-MPI-Linux-Python3.9-x86_64.tar.gz"
        tar -xf Paraview-5.11.2-osmesa-MPI-Linux-Python3.9-x86_64.tar.gz
        echo "${GITHUB_WORKSPACE}/ParaView-5.11.2-osmesa-MPI-Linux-Python3.9-x86_64/bin" >> "${GITHUB_PATH}"
    
    - name: Run paraview
      working-directory: ./gallery/monoblock
      shell: bash
      run: |
        pvbatch visualisation.py