trame: cannot run paraview example

I had a look at the trame tutorials, and they all work, except the paraview example:
https://kitware.github.io/trame/docs/tutorial-paraview.html
I get this error and I do not know what to do with it:
$ pvpython 05_paraview/StateLoader.py --venv .pvenv --data ./data/pv-state.pvsm

Traceback (most recent call last):
File “Codes/trame/trame-tutorial/05_paraview/StateLoader.py”, line 5, in
from trame.html import vuetify, paraview
File “/usr/local/lib/python3.9/dist-packages/trame/html/paraview/init.py”, line 1, in
from trame.html.vtk.common import (
File “/usr/local/lib/python3.9/dist-packages/trame/html/vtk/init.py”, line 21, in
use_module(VTK)
File “/usr/local/lib/python3.9/dist-packages/trame/html/vtk/common.py”, line 11, in use_module
_app.enable_module(m)
AttributeError: ‘App’ object has no attribute ‘enable_module’

I guess there is some paraview functionality missing? I’ve installed paraview superbuild from github:

$ paraview --version
paraview version 5.10.1-799-gb5dd20f80e

in the environment directory , there are references to enable_module:

~/Codes/trame/trame-tutorial/.pvenv/lib/python3.9$ grep -niIr 'enable_module' *


site-packages/trame/internal/app/app.py:104:def enable_module(module):
site-packages/trame/internal/app/app.py:111:    _app.enable_module(module)
site-packages/trame/html/widgets/__init__.py:7:_app.enable_module(Widgets)
site-packages/trame/html/simput/__init__.py:8:_app.enable_module(SimPut)
site-packages/trame/html/vega/__init__.py:9:_app.enable_module(VegaEmbed)
site-packages/trame/html/matplotlib/__init__.py:18:_app.enable_module(module)
site-packages/trame/html/plotly/__init__.py:14:_app.enable_module(Plotly)
site-packages/trame/html/markdown/__init__.py:8:_app.enable_module(Markdown)
site-packages/trame/html/xai/__init__.py:7:_app.enable_module(XAI)
site-packages/trame/html/vtk/common.py:12:    _app.enable_module(m)
site-packages/trame/html/deckgl/__init__.py:8:_app.enable_module(Deck)
site-packages/trame/html/observer/__init__.py:10:_app.enable_module(module)
site-packages/trame/html/router/__init__.py:7:_app.enable_module(Router)
site-packages/pywebvue/core.py:125:    def enable_module(self, module, **kwargs):
site-packages/pywebvue/core.py:150:        print("enableModule is deprecated, you should use 'enable_module' instead.")
site-packages/pywebvue/core.py:151:        self.enable_module(module, **kwargs)

I just tried the following and it is working for me.

  1. Download ParaView 5.10.1 from https://www.paraview.org/download/
  2. Run the following command lines
python3.9 -m venv pv_venv
source ./pv_venv/bin/activate
pip install -U pip
pip install trame
git clone https://github.com/Kitware/trame.git
/Applications/ParaView-5.10.1.app/Contents/bin/pvpython ./trame/examples/ParaView/StateViewer/app.py --venv ./pv_venv --data /.../diskout.pvsm

The following also worked

export PV_VENV=$PWD/pv_venv
/Applications/ParaView-5.10.1.app/Contents/bin/pvpython ./trame/examples/ParaView/StateViewer/app.py --data /.../diskout.pvsm

Thanks, using the paraview 5.10.1 package works. Actually, this example also works with my superbuild version.
However, the paraview example from the trame tutorial is not working for either
With the precompiled paraview, I get this:

~/Codes/paraview/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/pvpython 05_paraview/StateLoader.py --venv ./pv_venv --data ./data/pv-state.pvsm                                              
Traceback (most recent call last):
File "/home/nijso/Codes/trame/trame-tutorial/05_paraview/StateLoader.py", line 4, in <module>
from trame import get_cli_parser
ImportError: cannot import name 'get_cli_parser' from 'trame' (unknown location)

I guess you found an API change that was not updated in the tutorial repo… :wink:

I’ll fix the tutorial file… thx

Ok the reason was that I was using a local venv import as it was not available from ParaView at the time of the tutorial. To make the tutorial works you need to be inside that directory.

Still updating the tutorial code to import the now available venv helper directly from ParaView…

I have no luck so far – am I missing something?

$ ~/git/trame                                                                                                                                     
(base) > $ python -m venv pv_venv                                                                                                                          

$ ~/git/trame                                                                                                                                     
(base) > $ source ./pv_venv/bin/activate                                                                                                                   

$ ~/git/trame                                                                                                                                     
(pv_venv) (base) > $ python --version                                                                                                                      
Python 3.10.8

$ ~/git/trame                                                                                                                                     
(pv_venv) (base) > $ pip list                                                                                                                              
Package    Version
---------- -------
pip        22.2.2
setuptools 63.2.0

[notice] A new release of pip available: 22.2.2 -> 23.0.1
[notice] To update, run: pip install --upgrade pip

$ ~/git/trame                                                                                                                                     
(pv_venv) (base) > $ pip install -U pip                                                                                                                    
Requirement already satisfied: pip in ./pv_venv/lib/python3.10/site-packages (22.2.2)
Collecting pip
  Using cached pip-23.0.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.2.2
    Uninstalling pip-22.2.2:
      Successfully uninstalled pip-22.2.2
Successfully installed pip-23.0.1

$ ~/git/trame                                                                                                                                     
(pv_venv) (base) > $ pip install trame                                                                                                                     
Collecting trame
  Using cached trame-2.3.2-py3-none-any.whl (19 kB)
Collecting trame-plotly==2.1.0
  Using cached trame_plotly-2.1.0-py3-none-any.whl (12.1 MB)
Collecting trame-matplotlib==2.0.1
  Using cached trame_matplotlib-2.0.1-py3-none-any.whl (110 kB)
Collecting trame-components==2.1.0
  Using cached trame_components-2.1.0-py3-none-any.whl (1.2 MB)
Collecting trame-deckgl==2.0.1
  Using cached trame_deckgl-2.0.1-py3-none-any.whl (708 kB)
Collecting trame-vega==2.0.2
  Using cached trame_vega-2.0.2-py3-none-any.whl (339 kB)
Collecting trame-simput<3.0.0
  Using cached trame_simput-2.3.1-py3-none-any.whl (502 kB)
Collecting trame-router==2.0.1
  Using cached trame_router-2.0.1-py3-none-any.whl (30 kB)
Collecting trame-rca<3.0.0
  Using cached trame_rca-0.3.0-py3-none-any.whl (179 kB)
Collecting trame-markdown==2.0.2
  Using cached trame_markdown-2.0.2-py3-none-any.whl (1.5 MB)
Collecting trame-vtk<3.0.0
  Using cached trame_vtk-2.2.3-py3-none-any.whl (450 kB)
Collecting trame-client>=2.1.0
  Using cached trame_client-2.7.4-py3-none-any.whl (221 kB)
Collecting trame-vuetify<3.0.0
  Using cached trame_vuetify-2.2.4-py3-none-any.whl (3.3 MB)
Collecting trame-server>=2.9.0
  Using cached trame_server-2.9.1-py3-none-any.whl (27 kB)
Collecting wslink
  Using cached wslink-1.10.1-py3-none-any.whl (28 kB)
Collecting pyyaml
  Using cached PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (682 kB)
Collecting aiohttp<4
  Using cached aiohttp-3.8.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB)
Collecting attrs>=17.3.0
  Using cached attrs-22.2.0-py3-none-any.whl (60 kB)
Collecting charset-normalizer<4.0,>=2.0
  Using cached charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (199 kB)
Collecting async-timeout<5.0,>=4.0.0a3
  Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting multidict<7.0,>=4.5
  Using cached multidict-6.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (114 kB)
Collecting aiosignal>=1.1.2
  Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting yarl<2.0,>=1.0
  Using cached yarl-1.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (264 kB)
Collecting frozenlist>=1.1.1
  Using cached frozenlist-1.3.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (149 kB)
Collecting idna>=2.0
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Installing collected packages: trame-client, trame-vuetify, trame-vtk, trame-vega, trame-router, trame-plotly, trame-matplotlib, trame-markdown, trame-deckgl, trame-components, pyyaml, multidict, idna, frozenlist, charset-normalizer, attrs, async-timeout, yarl, trame-simput, aiosignal, aiohttp, wslink, trame-server, trame-rca, trame
Successfully installed aiohttp-3.8.4 aiosignal-1.3.1 async-timeout-4.0.2 attrs-22.2.0 charset-normalizer-3.1.0 frozenlist-1.3.3 idna-3.4 multidict-6.0.4 pyyaml-6.0 trame-2.3.2 trame-client-2.7.4 trame-components-2.1.0 trame-deckgl-2.0.1 trame-markdown-2.0.2 trame-matplotlib-2.0.1 trame-plotly-2.1.0 trame-rca-0.3.0 trame-router-2.0.1 trame-server-2.9.1 trame-simput-2.3.1 trame-vega-2.0.2 trame-vtk-2.2.3 trame-vuetify-2.2.4 wslink-1.10.1 yarl-1.8.2

$ ~/git/trame                                                                                                                                     
(pv_venv) (base) > $ pip list                                                                                                                              
Package            Version
------------------ -------
aiohttp            3.8.4
aiosignal          1.3.1
async-timeout      4.0.2
attrs              22.2.0
charset-normalizer 3.1.0
frozenlist         1.3.3
idna               3.4
multidict          6.0.4
pip                23.0.1
PyYAML             6.0
setuptools         63.2.0
trame              2.3.2
trame-client       2.7.4
trame-components   2.1.0
trame-deckgl       2.0.1
trame-markdown     2.0.2
trame-matplotlib   2.0.1
trame-plotly       2.1.0
trame-rca          0.3.0
trame-router       2.0.1
trame-server       2.9.1
trame-simput       2.3.1
trame-vega         2.0.2
trame-vtk          2.2.3
trame-vuetify      2.2.4
wslink             1.10.1
yarl               1.8.2

$ ~/git/trame                                                                                                                                     
(pv_venv) (base) > $ export PV_VENV=$PWD/pv_venv                                                                                                           

$ ~/git/trame                                                                                                                                     
(pv_venv) (base) > $ ParaView-5.11.0-egl-MPI-Linux-Python3.9-x86_64/bin/pvpython examples/07_paraview/StateViewer/app.py                                   
Ignoring PCI device with non-16bit domain.
Pass --enable-32bits-pci-domain to configure to support such devices
(warning: it would break the library ABI, don't enable unless really needed).
ParaView is using venv: /home/vsp/git/trame/pv_venv
Traceback (most recent call last):
  File "/home/vsp/git/trame/examples/07_paraview/StateViewer/app.py", line 10, in <module>
    from trame.app import get_server
ModuleNotFoundError: No module named 'trame'

Looks like you’re using Python 3.10. Python 3.9 is required since ParaView binaries are built with Python 3.9.

2 Likes