# How to build headless paraview in local?

**URL:** https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248
**Category:** ParaView Support
**Tags:** python
**Created:** [March 22, 2022, 5:20am UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248 "2022-03-22T05:20:28Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Ying](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@Ying](https://discourse.paraview.org/u/Ying)
#### Post date: [March 22, 2022, 5:20am UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/1 "2022-03-22T05:20:28Z")

</div>

Hi all,

Now I use **ubuntu 18.04 + openfoam 4.1 + paraview 5.0.1 (compile installation)**, and I can run the python script using `pvpython XX.py`, but the interactive window would appear during the running.

So I want to use the **headless version of paraview** , I find some methods to build it, like directly download headless version form offical website, or compile the headless version by yourself using `EGL` or `OSMESA`. But I am still confused about how to use it.

Does anyone give me some suggestion? My local graphics device is NVIDIA GeForce GTX 1660.

Thanks!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 22, 2022, 10:44am UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/2 "2022-03-22T10:44:51Z")

</div>

Hi @Ying ,

> [@Ying](#):
>
> paraview 5.0.1

Super old, please use the last release from [https://www.paraview.org/download/](https://www.paraview.org/download/)

> I want to use the **headless version of paraview** ,

No, you want to use offscreen rendering, with **the latest paraview** this is `pvpython --force-offscreen-rendering`

---

<div class="post-metadata">

### Author: ![Ying](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@Ying](https://discourse.paraview.org/u/Ying)
#### Post date: [March 22, 2022, 1:57pm UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/3 "2022-03-22T13:57:03Z")

</div>

Hi @mwestphal,

Thanks for your information! My current paraview 5.0.1 is compiled installed together with openfoam 4.1 in ubuntu 18.04. Can I just upgrade it? Or I need to download the latest version paraview and reinstall it in linux?

Thanks!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 22, 2022, 2:01pm UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/4 "2022-03-22T14:01:27Z")

</div>

> [@Ying](#):
>
> Can I just upgrade it

I dont think so. There is no reason to use the version of ParaView built with openfoam anyway.

> [@I want to visualize my OpenFOAM simulation results with ParaView but I'm confused, which version should I use ?](https://discourse.paraview.org/t/i-want-to-visualize-my-openfoam-simulation-results-with-paraview-but-im-confused-which-version-should-i-use/7232/1):
>
> Short Answer: go to [paraview.org/download](http://paraview.org/download) download the last version of ParaView available Use it to visualize your results Long Answer: OpenFOAM ships with a script named paraFoam, which can be used to call ParaView with custom OpenFOAM-specific reader modules, as well as with the standard reader that comes with ParaView/VTK. As stated in the OpenFOAM wiki, There is almost no reason to use these particular reader modules instead of the official binary release. Also, this discourse can…

---

<div class="post-metadata">

### Author: ![Ying](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@Ying](https://discourse.paraview.org/u/Ying)
#### Post date: [March 22, 2022, 2:08pm UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/5 "2022-03-22T14:08:08Z")

</div>

Thanks! I will download the latest version from official website.

```auto
No, you want to use offscreen rendering, with the latest paraview this is pvpython --force-offscreen-rendering

```

By saying this sentence, do you mean the headless paraview (without graphics and X server) and the paraview with --force-offscreen-rendering is the same thing?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 22, 2022, 3:08pm UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/6 "2022-03-22T15:08:24Z")

</div>

I mean that they are not the same thing at all. Read this:

[https://kitware.github.io/paraview-docs/v5.9.0/cxx/Offscreen.html](https://kitware.github.io/paraview-docs/v5.9.0/cxx/Offscreen.html)

---

<div class="post-metadata">

### Author: ![catiocean](https://discourse.paraview.org/user_avatar/discourse.paraview.org/catiocean/32/11663_2.png) [@catiocean](https://discourse.paraview.org/u/catiocean)
#### Post date: [May 26, 2023, 1:54am UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/7 "2023-05-26T01:54:07Z")

</div>

Hi all,  
I just would like to jump into this question since I have a similar issue that I don’t want the interactive window appear during when I run pvpython XXX.py. However, I am running Paraview 5.10.0 on cluster/supercomputer, which has strict limitation on rendering. So I wonder what steps I should take to build headless paraview that generate offscreen rendering without requiring an accessible X server. Thank you!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 26, 2023, 6:00am UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/8 "2023-05-26T06:00:00Z")

</div>

Offscreen and headless are not the same thing.

You have a graphical environnement (Xorg) but do not want the window to show → offscreen  
You do not have a graphical env or even no GPU at all → headless

To render offscreen, use the standard paraview release but instead of `pvpython`, run with `pvbatch`.  
To render headless, use the EGL (need a GPU) and OSMESA (no GPU needed) release.

---

<div class="post-metadata">

### Author: ![catiocean](https://discourse.paraview.org/user_avatar/discourse.paraview.org/catiocean/32/11663_2.png) [@catiocean](https://discourse.paraview.org/u/catiocean)
#### Post date: [May 26, 2023, 5:05pm UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/9 "2023-05-26T17:05:06Z")

</div>

Thank you very much Mathieu! We will explore the suitable solution for our case.

---

<div class="post-metadata">

### Author: ![dr-br](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dr-br/32/14134_2.png) [@dr-br](https://discourse.paraview.org/u/dr-br)
#### Post date: [April 23, 2024, 10:21am UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/10 "2024-04-23T10:21:19Z")

</div>

Dear other paraview-on-supercomputers-users,  
dear @catiocean ,  
just fool paraview and pretend it uses an x-server 😉

```auto
xvfb-run -a -s "-screen 0 3840x2160x24" pvpython myScript.py

```

The tool `xvfb-run` is not uncommon on our machines. In case, you want to run many scripts in parallel (e.g. with a `&` at the end of above line), this might cause problems. Just have a look [xvfb-run unreliable when multiple instances invoked in parallel - Stack Overflow](https://stackoverflow.com/a/30336424)  
The following command, however lets you run many post-processing scripts in parallel.

```auto
xvfb-run-safe -a -s "-screen 0 3840x2160x24" pvpython myScript.py

```

Edit: Of course other resolutions than 4K are possible as well 😉

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [April 23, 2024, 1:07pm UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/11 "2024-04-23T13:07:40Z")

</div>

> [@dr-br](#):
>
> just fool paraview and pretend it uses an x-server 😉

And get very bad rendering performance because you are using mesa instead of GPU accelerated egl.  
It could be considered an alternative to osmesa but I would not expect good performance compared to osmesa either.

---

<div class="post-metadata">

### Author: ![dr-br](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dr-br/32/14134_2.png) [@dr-br](https://discourse.paraview.org/u/dr-br)
#### Post date: [April 23, 2024, 3:53pm UTC](https://discourse.paraview.org/t/how-to-build-headless-paraview-in-local/9248/12 "2024-04-23T15:53:59Z")

</div>

~~The performance is bad. I agree.~~  
Reading my own answers below I can state: Performance is good

1. I don’t have GPU on compute nodes (most of them)
2. Typically on a supercomputer you submit a compute job and have to wait a couple of hours/days, till the job starts. The additional time delay due to performance does absolutely not hurt 😉  
BTW: performance is actually not that bad! Depending on the viz-pipeline reading result files from the file system does consume more time than the actual rendering job. So file system IO is the bottleneck here.
3. I simply start many jobs in parallel if I have a couple of different visualization tasks
4. I can create images on a per-frame basis. So I can additionally introduce parallelism by creating one image per CPU core. RAM usage does not hurt me as I have enough of that.
