sfepy / sfepy

Main SfePy repository
http://sfepy.org
BSD 3-Clause "New" or "Revised" License
731 stars 184 forks source link

`postproc.py` does not work without a GUI #770

Closed WhymustIhaveaname closed 2 years ago

WhymustIhaveaname commented 2 years ago

My server does not have a GUI (I think most servers are in my situation). So I want to save directly the result directly to a png file.

I tried -n and --no-offscreen. None of them works.

$ python3 ./postproc.py cylinder.vtk -o cylinder.png -n
2022-01-21 12:26:30.097 (   1.043s) [        5B37E740]vtkXOpenGLRenderWindow.:464    ERR| vtkXOpenGLRenderWindow (0x47e99a0): bad X server connection. DISPLAY=
Aborted (core dumped)
$ python3 ./postproc.py cylinder.vtk -o cylinder.png -n --no-offscreen
Traceback (most recent call last):
  File "./postproc.py", line 510, in <module>
    main()
  File "./postproc.py", line 500, in main
    view = view_file(filenames, filter_names, options)
  File "./postproc.py", line 258, in view_file
    view(show=options.show, is_3d=options.is_3d, view=options.view,
  File "/home/public/youran_Fem/sfepy/sfepy/postprocess/viewer.py", line 897, in call_mlab
    scene = mlab.figure(fgcolor=fgcolor, bgcolor=bgcolor,
  File "/usr/local/lib/python3.8/dist-packages/mayavi/tools/figure.py", line 64, in figure
    engine = get_engine()
  File "/usr/local/lib/python3.8/dist-packages/mayavi/tools/engine_manager.py", line 92, in get_engine
    return self.new_engine()
  File "/usr/local/lib/python3.8/dist-packages/mayavi/tools/engine_manager.py", line 137, in new_engine
    check_backend()
  File "/usr/local/lib/python3.8/dist-packages/mayavi/tools/engine_manager.py", line 40, in check_backend
    raise ImportError(msg)
ImportError: Could not import backend for traitsui.  Make sure you
        have a suitable UI toolkit like PyQt/PySide or wxPython
        installed.

I also tried to run this on my laptop but it needs the whole sfepy to be installed. But installing sfepy again is painful and a visualizing script should not be coupled with other parts of a package.

WhymustIhaveaname commented 2 years ago

Following the advice of https://github.com/sfepy/sfepy/issues/760, I use resview.py directly on my laptop and it works!

image

rc commented 2 years ago

Yes, we are slowly moving from mayavi, which is rather heavy-weight, to pyvista, which is a more direct interface to VTK. FWIW, you can also use any other VTK-capable software such as paraview (not sure if/how it works without GUI).