pvpython: bad X server connection


I get the following error when I try to run a script with pvpython on a virtual machine (Ubuntu 16.04):

ERROR: In /build/paraview-arsa8T/paraview-5.0.1+dfsg1/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 333
vtkXOpenGLRenderWindow (0x3acfad0): bad X server connection. DISPLAY=Aborted (core dumped)

The error disappears when I log on with “ssh -X” to the machine but it does not solve my problem because this machine is actually used as a slave for continuous integration of some code. I know that the problem comes from the fact that there is no X server on this machine. However, I do not know anything about X servers and how to configure them on Ubuntu systems. I looked for some documentation on the web. Then, I tried to install packages and use autoconfiguration commands but the error message is still here.

Do you know how to set up such a server for paraview on Ubuntu systems?

What is the script doing that is causing a window to be required? It’d probably be easier to have a GUI-less ParaView build (no Qt) or to have it built to prefer offscreen rendering instead so it doesn’t need X at all.

1 Like

If you don’t want to install an X server, you can use a binary of ParaView built against osmesa. We are going to produce official release binaries built against osmesa starting with ParaView 5.6. Using this build does away with the need for an X server.

Our nightly builds for this package are down for the moment, otherwise, I would point you to one to try out.

1 Like

Thank you very much for your answers.

I did not know that it was possible to run paraview without any X server. I will try to build my own version with osmesa.

As I did not write the script myself, I cannot tell if opening a window is required in my case because I only used Paraview GUI by the past, not Python API. I only know that the goal of the script is to generate an image (to be inserted in a documentation) by post-processing some results coming from a numerical simulation (computational fluid dynamics). Theoretically speaking, I would say that it could be possible to generate such an image without opening any window but I cannot be sure about that.

Here are the main script (postpro_lagrangian.py) and its subscript (postpro_settling.py) if you have any advice about them.

postpro_lagrangian.py (5.6 KB)
postpro_settling.py (2.7 KB)

An X server is required for all ParaView packages except the osmesa package, even if offscreen rendering is used and no window is opened. This is because most OpenGL applications on linux still depend on X to draw anything, even if no window appears.

There is a binary available here, but it will disappear in about 24 hours as disk space is reclaimed, so if you want it download it quick.


Thank you very much. I will download it now and try to use it to see if it solves my problem.

It works fine. Thank you very much for your precious help!

Fantastic, I am glad it is working.

By the way, the ParaView 5.6.0 build with osmesa is now available at www.paraview.org/download.