VTK Trame Docker GPU Rendering

Hi I’m trying to render a vti file inside trame docker image. There’s an existing sample code that I prepared for rendering same on a linux machine in working state. However, when I converted it into trame format for docker getting following error while building:

Traceback (most recent call last):
  File "/deploy/server/venv/lib/python3.9/site-packages/trame/tools/www.py", line 26, in enable_modules
    module = importlib.import_module(f"trame.modules.{module_name}")
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'trame.modules.vtiViewer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/deploy/server/venv/lib/python3.9/site-packages/trame/tools/www.py", line 76, in <module>
    main()
  File "/deploy/server/venv/lib/python3.9/site-packages/trame/tools/www.py", line 69, in main
    generator.enable_modules(*module_names)
  File "/deploy/server/venv/lib/python3.9/site-packages/trame/tools/www.py", line 30, in enable_modules
    module = importlib.import_module(module_name)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/deploy/server/venv/lib/python3.9/site-packages/vtiViewer/__init__.py", line 1, in <module>
    from .app import main
  File "/deploy/server/venv/lib/python3.9/site-packages/vtiViewer/app/__init__.py", line 1, in <module>
    from .main import main
  File "/deploy/server/venv/lib/python3.9/site-packages/vtiViewer/app/main.py", line 2, in <module>
    from . import engine, ui
  File "/deploy/server/venv/lib/python3.9/site-packages/vtiViewer/app/engine.py", line 6, in <module>
    from vtkmodules.vtkRenderingVolumeOpenGL2 import vtkOpenGLRayCastImageDisplayHelper
ImportError: libXrender.so.1: cannot open shared object file: No such file or directory
module_name: vtiViewer.module
Build complete. Exiting.

Hi,

I assumed all trame and rendering related packages might be available in the trame image. The error resolved after installing libGl on trame image. Now, there’s another error. Will be working on it and update.

Mean X window system. With docker you should target an headless system using a backend like OSMesa or EGL but definitely not X.

Thanks @Sebastien_Jourdain for pointing that. Actually, I want to run trame application with remoteView which will use graphic card as well. I have done nvidia container setup and able to execute nvidia-smi using nvidia container. For trame I’m using kitware/trame:glvnd. Trying to build using build_server.sh sample application which is loading a vti file and rendering using remoteView. Getting error in build step only in import statement from vtkmodules.vtkRenderingVolumeOpenGL2 import vtkOpenGLRayCastImageDisplayHelper. If I don’t import this one then getting error related to missing implementation in using vtkGPUVolumeRayCastMapper mapper. Do I need to setup anything in existing image ?

You need to still import vtkRenderingVolumeOpenGL2 but the implementation needs to be EGL not X. To get a VTK/Python with an EGL backend, you will need to build it yourself. If you don’t want to build it, just use the ParaView-EGL build to run your VTK based code.

1 Like