This article provides step-by-step instruction on installing ParaView 5.9.x binary package on a personal computer running on Ubuntu 21.04.

The instructions given are for a Ubuntu 21.04 system, but it should also work for Ubuntu 20.04 and other Ubuntu-compatible distributions with Pop!_OS inclusive.

Tested environment

An x64-based laptop running on Ubuntu 21.04

  • Linux kernel version: 5.11.0-25-generic

An x64-based desktop running on Pop!_OS 21.04

  • Linux kernel version: 5.11.0-7620-generic

Preparation

1: Install the Open MPI package (and its dependencies) if not yet installed. Open MPI is an open source Message Passing Interface developed for high-performance computing.

$ sudo apt install openmpi-bin (1)
1 The prompt symbol $ indicates that you are typing at a terminal emulator (e.g. Ubuntu Terminal).

Check the installation by the accessibility to its mpiexec (or mpirun) executable:

$ which mpiexec
/usr/bin/mpiexec

2: Get the latest ParaView 5.9.x binary package for Linux from https://www.paraview.org/download/. The ParaView binary package for Linux includes the ParaView GUI (Graphical User Interface) client, pvpython, pvserver, pvbatch, and bundled MPI.

The current release used: ParaView-5.9.1-MPI-Linux-Python3.8-64bit.tar.gz

3: (Optional) In this article, we add a scenario that we would also need the previous stable release (i.e. 5.8.1) due to, for example, known dependency issues with other applications.

The previous release used: ParaView-5.8.1-MPI-Linux-Python3.7-64bit.tar.gz

(Optional) Previous stable release installation

You can skip this section if you either have the previous ParaView already up and running or do not need an older version at all.

Prepare a dedicated package folder for ParaView under your HOME directory (e.g. '/home/hawk/ParaView').

$ cd ~/ParaView/

Unzip the '.tar.gz' file to the package folder.

$ tar -xvzf ~/Downloads/ParaView-5.8.1-MPI-Linux-Python3.7-64bit.tar.gz -C ~/ParaView/

Check the directory structure — either by Files browser or using the tree command (To use the tree command, you need to install it by sudo apt install tree).

$ tree ./ParaView-5.8.1-MPI-Linux-Python3.7-64bit -d -L 2
./ParaView-5.8.1-MPI-Linux-Python3.7-64bit
├── bin
├── lib
│   ├── mesa
│   ├── paraview-5.8
│   └── python3.7
├── plugins
│   ├── iconengines
│   ├── imageformats
│   ├── platforminputcontexts
│   ├── platforms
│   ├── sqldrivers
│   └── xcbglintegrations
└── share
    ├── applications
    ├── icons
    ├── metainfo
    └── paraview-5.8

17 directories

Now, open your '~/.bashrc' file using a text editor (e.g. Gedit or SciTE, etc)

$ gedit ~/.bashrc

and add the path to your ParaView executables to the system PATH variable referring to the below example.

export PATH=~/ParaView/ParaView-5.8.1-MPI-Linux-Python3.7-64bit/bin:${PATH}

Save and exit, and then reread the '~/.bashrc' configuration using the source command:

$ source ~/.bashrc

You should now be able to launch ParaView by entering from a terminal:

$ paraview &

With ParaView started, try to visualise a sample data from the Example Visualization panel. The default mouse operations are:

  • Left button: rotates the viewport

  • Middle button: moves the viewport laterally (i.e. panning)

  • Right button: zooms in/out the viewport; the same effect using the mouse wheel.

shot0101

To exit from ParaView, select the File  Exit menu — or click the window close button (x).

You can open the Example Visualisations panel anytime from the Help  Example Visualizations menu.

Current stable release installation

Prepare a dedicated package folder for ParaView under your HOME directory (e.g. '/home/hawk/ParaView').

$ cd ~/ParaView/

Unzip the '.tar.gz' file to the package folder.

$ tar -xvzf ~/Downloads/ParaView-5.9.1-MPI-Linux-Python3.8-64bit.tar.gz -C ~/ParaView/

Check the directory structure — either by Files browser or using the tree command.

$ tree ./ParaView-5.9.1-MPI-Linux-Python3.8-64bit -d -L 2
./ParaView-5.9.1-MPI-Linux-Python3.8-64bit
├── bin
├── lib
│   ├── mesa
│   ├── mpi
│   ├── paraview-5.9
│   └── python3.8
├── plugins
│   ├── iconengines
│   ├── imageformats
│   ├── platforminputcontexts
│   ├── platforms
│   ├── sqldrivers
│   └── xcbglintegrations
└── share
    ├── applications
    ├── icons
    ├── metainfo
    └── paraview-5.9

18 directories

Open your '~/.bashrc' file using a text editor (e.g. Gedit or SciTE, etc)

$ gedit ~/.bashrc

and add the path to your ParaView executable to the system PATH variable referring to the below example.

export PATH=~/ParaView/ParaView-5.9.1-MPI-Linux-Python3.8-64bit/bin:${PATH}

Save and exit, and then reread the '~/.bashrc' configuration using the source command:

$ source ~/.bashrc

You can now launch ParaView by entering:

$ paraview &
shot0102

(Optional) Switching between different versions

This section is applicable if you have installed both the previous and the current stable releases of ParaView and want to switch between them on demand.

For example, your local package folder contains both ParaView 5.8.1 and ParaView 5.9.1, and you want to switch between versions on demand.

$ tree ~/ParaView/ -d -L 2
/home/hawk/ParaView/
├── ParaView-5.8.1-MPI-Linux-Python3.7-64bit
│   ├── bin
│   ├── lib
│   ├── plugins
│   └── share
└── ParaView-5.9.1-MPI-Linux-Python3.8-64bit
    ├── bin
    ├── lib
    ├── plugins
    └── share

10 directories

Open your '~/.bashrc' file to modify the path content for ParaView by referring to the below example.

# ParaView ##
##export PATH=~/ParaView/ParaView-5.8.1-MPI-Linux-Python3.7-64bit/bin:${PATH}
export PATH=~/ParaView/ParaView-5.9.1-MPI-Linux-Python3.8-64bit/bin:${PATH}

function pvUse() {
  thisVersion=$1
  currVersion=$(paraview --version | grep -Po '(?<=version )\d+.\d+.\d+')
  if [ $thisVersion = $currVersion ]; then
    echo ";-) You are using ParaView $thisVersion"
  elif [ $thisVersion = 5.8.1 ]; then
    export PATH=~/ParaView/ParaView-5.8.1-MPI-Linux-Python3.7-64bit/bin:${PATH}
    echo ":-D Now using ParaView 5.8.1"
    which paraview
  elif [ $thisVersion = 5.9.1 ]; then
    export PATH=~/ParaView/ParaView-5.9.1-MPI-Linux-Python3.8-64bit/bin:${PATH}
    echo ":-D Now using ParaView 5.9.1"
    which paraview
  else
    echo ":-O Available versions are: 5.8.1 5.9.1"
  fi
}

Save and exit, and then reread the '~/.bashrc' configuration using the source command:

$ source ~/.bashrc

The 'export' script above the 'pvUse()' function is there to set the default ParaView version as you log in. Check if the default version is correctly linked:

$ which paraview
/home/hawk/ParaView/ParaView-5.9.1-MPI-Linux-Python3.8-64bit/bin/paraview

Now check if the core part of the function switches between versions as expected:

$ pvUse 5.8.1
:-D Now using ParaView 5.8.1
/home/hawk/ParaView/ParaView-5.8.1-MPI-Linux-Python3.7-64bit/bin/paraview
$ pvUse 5.9.1
:-D Now using ParaView 5.9.1
/home/hawk/ParaView/ParaView-5.9.1-MPI-Linux-Python3.8-64bit/bin/paraview

The first and the last conditional blocks of the 'pvUse()' function handle a request of the same version as is being used or a version not on the menu.

$ pvUse 5.9.1
;-) You are using ParaView 5.9.1
$ pvUse 5.9.0
:-O Available versions are: 5.8.1 5.9.1

Post-installation configuration

Edit > Settings…​

In typical visualisation tasks, I would be interested in a later stage of a field variable — i.e. from a given initial condition. Setting the Default Time Step with the Go to last timestep option allows updating the graphics with the latest result on every reload.

Also, I prefer to set the Transfer Function Reset Mode by the Clamp and update every timestep option so that any scalar field be dynamically changing concerning the min/max range at the corresponding timestep, especially during the inspection stages.

shot0103

Renaming the bundled mpiexec executable

Because we have added the ParaView executables path to the system PATH variable, typing the mpiexec command picks up its executable from the ParaView bin directory — i.e. before it reaches the system-installed one.

$ which mpiexec
/home/hawk/ParaView/ParaView-5.9.1-MPI-Linux-Python3.8-64bit/bin/mpiexec

To prevent the ParaView’s mpiexec from intercepting the system-installed Open MPI executable, you may rename the bundled one in the ParaView bin folder accordingly.

$ cd ~/ParaView/ParaView-5.9.1-MPI-Linux-Python3.8-64bit/bin/
$ mv mpiexec pvmpiexec
$ cd -

Doing so will render other software (for example, OpenFOAM) to use the system-installed mpiexec:

$ which mpiexec
/usr/bin/mpiexec

You can still use the ParaView bundled one by 'pvmpiexec'. As an illustration, copy and paste the command block to the terminal:

echo 'from paraview.simple import *
sphere = Sphere()
rep = Show()
ColorBy(rep, ("POINTS", "vtkProcessId"))
Render()
rep.RescaleTransferFunctionToDataRange(True)
Render()
WriteImage("parasphere.png")
' > parasphere.py
(1)
1 An extra blank line is intended for the last line to be parsed on pasting.

Now, run the sample pvpython script using the bundled mpiexec, and then check the resulted image output:

$ pvmpiexec -np 4 pvbatch parasphere.py
parasphere