Way forward with Paraview Web

Hello,

Please accept my apologies for a long description.

We are using Paraview at the moment to visulaize OpenFoam files and we are planning to use it in Browser (Web). We want our sever to do heavy-lifting and browser rendering the results. There are a couple of products provided by Paraview and based on a couple of topics in this forum (most of them are old). I was under this impression that we should use paraviewweb. However, ParaviewWeb looks to be deprecated and no docker image has been created in last 4 years.

Main Question

  • What is the way forward to have paraview in web ? Which tools or project we should use? Trame or ParaviewWeb, Paraview (using luncher )?

To have a better understand of products, I have tried most of the examples provided while I hit walls on each of them as described below. Skip to issue 3, if we have to use Trame. Our sever specification:

  • Ubuntu 18
  • Instance type: g3.4xlarge
  • NVIDIA-SMI 470.141.03 Driver Version: 470.141.03 CUDA Version: 11.4

Issue 1 : I started with single user example in ParaViewWeb (kitware.github.io) and it is working. We need to have multi-session, So I followed the instruction to use Launcher in ParaViewWeb (kitware.github.io). Per run command provided as shown below, we should build Paraview in order to run luncher with luncher config.

$ cd  ParaView/build
$ ./bin/pvpython lib/site-package/vtk/web/launcher.py launcher.config

Question 1:

  • Is there anyway to run Paraview luncher with binary file that can be downloaded from Download ParaView? Like using version “ParaView-5.10.1-MPI-Linux-Python3.9-x86_64”
  • if not, how to build Paraview and run luncher?

Issue 2:
As we stuck on previous issue, we tried following instruction for Docker ParaViewWeb (kitware.github.io) and EC2 ParaViewWeb (kitware.github.io). Both instructions were failing with issue described in Minified reaction error #31 and websocket connection error · Issue #534 · Kitware/paraviewweb (github.com). We followed your suggestion of using generic pvm-* image and following generic container instruction in ParaViewWeb (kitware.github.io).

We created www (with index.html) and launcher (with config.json file as shown below) folders. We ran the docker with three different images including “kitware/paraviewweb:pvw-v5.6.0-egl”, “kitware/paraview:pvw-master-egl-py3” and “kitware/paraview:pvw-v5.8.0-egl-py3” (changed config file to reflect the path for different paraview version. in all three experiment we get below error message when redirecting to ec2-IP-XX-XX.ap-southeast-2.compute.amazonaws.com/paraview route. The root is showing the index.html successfully and visualizer path is returning 503.

Error

: 2023-04-16 07:21:30,183:CRITICAL:twisted:
Traceback (most recent call last):
  File "/opt/paraview/lib/python3.6/site-packages/twisted/web/server.py", line 199, in process
    self.render(resrc)
  File "/opt/paraview/lib/python3.6/site-packages/twisted/web/server.py", line 259, in render
    body = resrc.render(self)
  File "/opt/paraview/lib/python3.6/site-packages/twisted/web/resource.py", line 250, in render
    return m(request)
  File "/opt/paraview/lib/python3.6/site-packages/wslink/launcher.py", line 607, in render_GET
    id = extractSessionId(request)
  File "/opt/paraview/lib/python3.6/site-packages/wslink/launcher.py", line 252, in extractSessionId
    path = request.path.split('/')
***TypeError: a bytes-like object is required, not 'str'***

Launcher/config.json


{
  "resources": [ {"port_range": [9010, 9014], "host": "ec2--IP-XX-XX.ap-southeast-2.compute.amazonaws.com"} ],
  "sessionData": {},
  "configuration": {
    "log_dir": "/opt/launcher/log",
    "host": "localhost",
    "endpoint": "paraview",
    "sessionURL": "SESSION_URL_ROOT/proxy?sessionId=${id}&path=ws",
    "timeout": 25,
    "upload_dir": "/data/upload",
    "fields": [],
    "port": 9000,
    "proxy_file": "/opt/launcher/proxy-mapping.txt",
    "sanitize": {
      "file": {
          "type": "regexp",
          "regexp": "^[-\\\\w./]+$",
          "default": "emptyFile"
      }
    }
  },
  "properties": {
    "dataDir": "/data",
    "webapps_dir": "/opt/paraview/share/paraview-5.8/web",
    "python_exec": "/opt/paraview/bin/pvpython"
  },
  "apps": {
    "MySuperPVWApp": {
      "cmd": [
        "${python_exec}",
        EXTRA_PVPYTHON_ARGS
        "/pvw/server/pvw-server.py",
        "--port", "${port}",
        "--authKey", "${secret}",
        "--timeout", "30"
      ],
      "ready_line" : "Starting factory"
    },
    "visualizer": {
      "cmd": [
        "${python_exec}",
        EXTRA_PVPYTHON_ARGS
        "${webapps_dir}/visualizer/server/pvw-visualizer.py",
        "--port", "${port}",
        "--data", "${dataDir}",
        "--authKey", "${secret}",
        "--viewport-max-width", "1920",
        "--viewport-max-height", "1080",
        "--timeout", "30"
      ],
      "ready_line" : "Starting factory"
    },
    "visualizer-with-file": {
      "cmd": [
        "${python_exec}",
        EXTRA_PVPYTHON_ARGS
        "${webapps_dir}/visualizer/server/pvw-visualizer.py",
        "--port", "${port}",
        "--data", "${dataDir}",
        "--authKey", "${secret}",
        "--viewport-max-width", "1920",
        "--viewport-max-height", "1080",
        "--timeout", "30",
        "--load-file", "${file}"
      ],
      "ready_line" : "Starting factory"
    },
    "paraview-lite": {
      "cmd": [
        "${python_exec}",
        EXTRA_PVPYTHON_ARGS
        "${webapps_dir}/lite/server/pvw-lite.py",
        "--port", "${port}",
        "--data", "${dataDir}",
        "--authKey", "${secret}",
        "--viewport-max-width", "1920",
        "--viewport-max-height", "1080",
        "--timeout", "30"
      ],
      "ready_line" : "Starting factory"
    },
    "divvy": {
      "cmd": [
        "${python_exec}",
        EXTRA_PVPYTHON_ARGS
        "${webapps_dir}/divvy/server/pvw-divvy.py",
        "--port", "${port}",
        "--data", "${dataDir}/${file}",
        "--authKey", "${secret}",
        "--viewport-max-width", "1920",
        "--viewport-max-height", "1080",
        "--timeout", "30"
      ],
      "ready_line" : "Starting factory"
    }
  }
}

Docker command

export PORT=8080
export DATA=/home/ubuntu/fujin
export DEPLOY=/home/ubuntu/fujin/mypvw/
export SERVER_NAME=ec2-IP-XX-XX.ap-southeast-2.compute.amazonaws.com:443
export PROTOCOL=ws

sudo docker run --gpus all              \
    -p 0.0.0.0:${PORT}:80                \
    -v ${DATA}:/data                      \
    -v ${DEPLOY}:/pvw                      \
    -e "SERVER_NAME=${SERVER_NAME}"          \
    -e "PROTOCOL=${PROTOCOL}"                 \
    -dti kitware/paraview:pvw-v5.8.0-egl-py3

Apache 001-pvw.conf

<VirtualHost *:80>
  ServerName   ec2--IP-XX-XX.ap-southeast-2.compute.amazonaws.com
  ServerAdmin  arash@example.com
  DocumentRoot /home/ubuntu/fujin/mypvw/www
  ErrorLog /home/ubuntu/fujin/mypvw/logs/error.log
  CustomLog /home/ubuntu/fujin/mypvw/logs/access.log combined
  ProxyPass /visualizer http://localhost:8080/visualizer
  ProxyPassReverse /visualizer http://localhost:8080/visualizer
  ProxyPass /paraview http://localhost:8080/paraview
  RewriteEngine On
  RewriteMap session-to-port txt:/home/ubuntu/fujin/mappingfile/proxy.txt
  RewriteCond %{QUERY_STRING}     ^sessionId=(.*)&path=(.*)$ [NC]

  # This does the rewrite using the mapping file and the sessionId
  RewriteRule    ^/proxy.*$  ws://${session-to-port:%1}/%2  [P]

  <Directory /home/ubuntu/paraviewweb-docker/testsite/www>
        Options Indexes FollowSymLinks
        Order allow,deny
        Allow from all
        AllowOverride None
        Require all granted
  </Directory>

</VirtualHost>

Question 2

  • Any idea what we missed in this setup?
  • Do you have any plan creating updated Paraview Image such as version 5.10?

Issue 3:
Considering having issues in above two approaches, we continued our investigation on using Kitware/paraview-visualizer: Web frontend to ParaView based on trame (github.com). there was on issue in Pip and Npm Installation and finally we ran below command on Ubuntu 18:

 ../ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/pvpython  -m paraview.apps.trame --venv myvenv --trame-app pv_visualizer --data /home/ubuntu/fujin/paraview-visualizer/ 
 ../ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/pvpython  -m paraview.apps.trame --venv myvenv --trame-app pv_visualizer --data /home/ubuntu/fujin/paraview-visualizer/ 

Error:

ubuntu@ip-172-20-2-55:~/fujin/paraview-visualizer$ ../ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/pvpython  -m paraview.apps.trame --venv myvenv --trame-app pv_visualizer --data /home/ubuntu/fujin/paraview-visualizer/ 
ParaView is using venv: /home/ubuntu/fujin/paraview-visualizer/.venv
VisRTX 0.1.6, using devices:
 0: Tesla M60 (Total: 8.0 GB, Available: 7.6 GB)

App running at:
 - Local:   http://localhost:8080/
 - Network: http://172.20.2.55:8080/

Note that for multi-users you need to use and configure a launcher.
Traceback (most recent call last):
  File "/home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/apps/trame.py", line 26, in <module>
    main()
  File "/home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/apps/trame.py", line 23, in main
    module.main()
  File "/home/ubuntu/fujin/paraview-visualizer/pv_visualizer/app/main.py", line 41, in main
    return server.start(**kwargs)
  File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/core.py", line 556, in start
    task = CoreServer.server_start(
  File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/protocol.py", line 50, in server_start
    return server.start_webserver(
  File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/wslink/server.py", line 301, in start_webserver
    return exec_modes[exec_mode]()
  File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/wslink/server.py", line 284, in main_exec
    loop.run_until_complete(create_coroutine())
  File "/home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/wslink/backends/aiohttp/__init__.py", line 126, in start
    port_callback(self.get_port())
  File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/protocol.py", line 95, in port_callback
    self.server.controller.on_server_ready(**self.server.state.to_dict())
  File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/controller.py", line 283, in __call__
    results = list(map(lambda f: f(*args, **kwargs), copy_list))
  File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/controller.py", line 283, in <lambda>
    results = list(map(lambda f: f(*args, **kwargs), copy_list))
  File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/controller.py", line 277, in __call__
    result = f(*args, **kwargs)
  File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_vtk/widgets/vtk/common.py", line 547, in update
    self.update_geometry(
  File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_vtk/widgets/vtk/common.py", line 487, in update_geometry
    delta_state = MODULE.scene(
TypeError: scene() got an unexpected keyword argument 'widgets'

Question 3

  • Any idea what we missed in configurations?

Main answer can be found here: Questions Architecture Related Paraview-Web - #2 by jourdain

Q1: Yes, you can use the trame images for that. This basically allow us to not build a custom docker for each release/flavor of ParaView. You can see a usage of it here.

Q2: Those are legacy doc really good for reference but not really useful today for new comers.

Q3: The error you are getting seems to be related to some update on trame-vtk that aim to capture widgets behaviors in the scene serialization. Can you tell us which version of trame-vtk is getting pulled on your side? It is most likely a bug in trame-vtk with ParaView. In order to solve that issue before a fix is properly pushed, you can set the version of trame-vtk in your requirements to trame-vtk==2.4.1.

HTH

Issue 3 should now be fixed in trame-vtk>=2.4.4.

Thanks for pointing out the issue.

Thanks, Sebastien, for your response. It clears our short and long path using Paraview for us.

ISSUE 1
I tried using trame images in paraview-visualizer/docker per your kind suggestion. The “./scripts/build_image.sh” finished successfully after updating line 8 in Dockerfile, as mentioned binary doesn’t exist. I replace it with a link to download “ParaView-5.10.1-MPI-Linux-Python3.9-x86_64.tar.gz”. When we ran ./scripts/build_image.sh or sudo docker run --rm --gpus all -p 8080:80 -v /home/ubuntu/fujin:/data -d pv-visualizer. It is not creating any containers while image ‘pv-visualizer’ exist.

(.venv) ubuntu@ip-xx:~/fujin/paraview-visualizer/docker$ sudo docker run --rm --gpus all -p 8080:80 -v /home/ubuntu/fujin:/data -d pv-visualizer
dbd75e988dfe4fd88c282fbb07af25841d1fbf28b72e540776cf055f45b769ce
(.venv) ubuntu@ip-xx:~/fujin/paraview-visualizer/docker$ sudo docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
(.venv) ubuntu@ip-xx:~/fujin/paraview-visualizer/docker$ sudo docker image ls
REPOSITORY            TAG                                  IMAGE ID       CREATED             SIZE
pv-visualizer         latest                               1316d8d221c8   About an hour ago   3.18GB

Questions 1:
– Any idea what we missed here?
– The main aim for this experiment for us is to use Paraview Visualizer immediately as we could run it without launcher config for short term use till we could use trame.Could we run Paraview launcher without building/compiling Paraview (Judging by path to ParaView/build)?

$ cd  ParaView/build
$ ./bin/pvpython lib/site-package/vtk/web/launcher.py launcher.config

ISSUE 3
The trame-vtk>=2.4.4 and upgrading trame-client resolved issue 3.

When I ran below command in Paraview-visualizer Or Paraview example of Trame tutorial, I will see following" error: exception occurred: Segmentation fault". I was able to run other trame tutorials except number 5.

 ../ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/pvpython  -m paraview.apps.trame --venv .venv --trame-app pv_visualizer --data ~ --port 1234 --host 0.0.0.0

Interestingly enough, trame is appearing for a second in browser then throws exception. Please find full error and browser console log.

Error Stack

ubuntu@ip-XXXX:~/fujin/paraview-visualizer$ ../ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/pvpython  -m paraview.apps.trame --venv .venv --trame-app pv_visualizer --data ~ --port 1234 --host 0.0.0.0
ParaView is using venv: /home/ubuntu/fujin/paraview-visualizer/.venv
VisRTX 0.1.6, using devices:
 0: Tesla M60 (Total: 8.0 GB, Available: 7.6 GB)

App running at:
 - Local:   http://0.0.0.0:1234/
 - Network: http://172.20.2.55:1234/

Note that for multi-users you need to use and configure a launcher.
And to prevent your browser from opening, add '--server' to your command line.

Loguru caught a signal: SIGSEGV
Stack trace:
107           0x401f7f /home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/pvpython-real() [0x401f7f]
106     0x7f8a513c7083 __libc_start_main + 243
105           0x4027be /home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/pvpython-real() [0x4027be]
104     0x7f8a4eca6db4 vtkPythonInterpreter::PyMain(int, char**) + 532
103     0x7f8a4c19b053 Py_Main + 67
102     0x7f8a4c19a835 Py_RunMain + 981
101     0x7f8a4c19a20c /home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/../lib/libpython3.9.so.1.0(+0x22d20c) [0x7f8a4c19a20c]
100     0x7f8a4c029fb4 PyVectorcall_Call + 84
99      0x7f8a4c02a2d1 _PyFunction_Vectorcall + 177
98      0x7f8a4c12ff09 /home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/../lib/libpython3.9.so.1.0(+0x1c2f09) [0x7f8a4c12ff09]
97      0x7f8a4bfdadcb _PyEval_EvalFrameDefault + 22283
....
6       0x7f8a46babada vtkPVRenderView::Render(bool, bool) + 2074
5       0x7f8a36065c30 vtkXOpenGLRenderWindow::Render() + 32
4       0x7f8a35fc7511 vtkOpenGLRenderWindow::Render() + 81
3       0x7f8a320e56f9 vtkRenderWindow::Render() + 169
2       0x7f8a35c784bc vtkXRenderWindowInteractor::Initialize() + 204
1       0x7f8a35b697bf XSync + 31
0       0x7f8a513e6090 /lib/x86_64-linux-gnu/libc.so.6(+0x43090) [0x7f8a513e6090]
(  31.361s) [paraview        ]                       :0     FATL| Signal: SIGSEGV
error: exception occurred: Segmentation fault

Browser Console

POST http://ec2-XXXX.ap-southeast-2.compute.amazonaws.com:1234/paraview/ 405 (Method Not Allowed)
D.e.start @ chunk-vendors.ec946a94.js:1
L.e.connect @ chunk-vendors.ec946a94.js:1
(anonymous) @ chunk-vendors.ec946a94.js:1
e.connect @ chunk-vendors.ec946a94.js:1
re @ app.1733a6d7.js:1
8327 @ app.1733a6d7.js:1
n @ app.1733a6d7.js:1
(anonymous) @ app.1733a6d7.js:1
n.O @ app.1733a6d7.js:1
(anonymous) @ app.1733a6d7.js:1
(anonymous) @ app.1733a6d7.js:1
app.1733a6d7.js:1 Vue.use(trame_simput, {}) - true - install(true)
app.1733a6d7.js:1 Vue.use(trame_vuetify, {"icons":{"values":{"pqEditColor":{"component":"pq-edit-color"},"pqEditScalarBar":{"component":"pq-edit-scalar-bar"},"pqFavorites":{"component":"pq-favorites"},"pqResetRange":{"component":"pq-reset-range"},"pqResetRangeCustom":{"component":"pq-reset-range-custom"},"pqResetRangeTemporal":{"component":"pq-reset-range-temporal"},"pqScalarBar":{"component":"pq-scalar-bar"},"pqSeparateColorMap":{"component":"pq-separate-color-map"}}}}) - true - install(true)
app.1733a6d7.js:1 Vue.use(trame_components, {}) - true - install(true)
app.1733a6d7.js:1 Vue.use(pv_visualizer, {}) - true - install(true)
use.js:12 register vue widget pqEditColor
use.js:12 register vue widget pqEditScalarBar
use.js:12 register vue widget pqFavorites
use.js:12 register vue widget pqResetRange
use.js:12 register vue widget pqResetRangeCustom
use.js:12 register vue widget pqResetRangeTemporal
use.js:12 register vue widget pqScalarBar
use.js:12 register vue widget pqSeparateColorMap
app.1733a6d7.js:1 Vue.use(vue_vtk, {}) - true - install(true)
trame-vuetify.css:1 
        
        
GET http://ec2-xxx.ap-southeast-2.compute.amazonaws.com:1234/__trame_vuetify/fonts/roboto-latin-500.1dfbc3db.woff2 net::ERR_CONNECTION_RESET

chunk-vendors.ec946a94.js:1  Uncaught (in promise) {code: -32099, message: 'RPC call viewport.image.push.observer.remove unsuccessful: connection not open'}
app.1733a6d7.js:1  Uncaught (in promise) {code: -32099, message: 'RPC call trame.state.update unsuccessful: connection not open'}

Any feedback on this Issue is greatly appreciated.

You downloaded the wrong ParaView. You need the offscreen version that is using EGL.

Also the launcher is not in lib/site-package/vtk/web/launcher.py but available in pvpython -m wslink.launcher launcher.config

HTH

Thank you very much. That was great help. Issue 3 is completely resolved.

Issue 1. The docker in paraview-visualizer/docker is still failing with below error message even after building image with correct Paraview Binary. I haven’t investigated the reason of this issue yet and i just put it here.

Error Message:

  • Error while finding module specification for ‘wslink.launcher’ (ModuleNotFoundError: No module named ‘wslink’)
(.venv) ubuntu@ip-XXX/paraview-visualizer/docker$ sudo docker run --rm --gpus all -p 0.0.0.0:1234:80 -v /home/ubuntu/fujin -ti pv-visualizer -e "SERVER_NAME=ec2-X.ap-southeast-2.compute.amazonaws.com" --venv .venv" 
 * Restarting Apache httpd web server apache2    
   AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
                                                                                                                                                                                                    [ OK ]
Starting server...
/opt/trame/activate_venv.sh: line 1: /deploy/server/venv/bin/activate: No such file or directory
/opt/trame/run.sh: line 20: /deploy/server/launcher.json: No such file or directory
Starting the wslink launcher at
/usr/bin/python: Error while finding module specification for 'wslink.launcher' (ModuleNotFoundError: No module named 'wslink')

Once again. Thanks for your all your help and support.

This means you did not build your server directory before building your docker image or at least something didn’t go as planned when build_server.sh executed.