Repository: pyvista/pyvista

Issue #6841: export_html not running out of the box
Created: 2024-11-22T13:35:08Z
Describe the bug, what's wrong, and what you expected.
After a fresh installation of pyvista I tried to run the example of exporting to html. It complained of not having trame_vtk installed. I installed it with pip. Then it complained about not having trame installed. I installed it with pip. It still complains. Here is the error message right now:
Traceback (most recent call last):
  File "/home/manuel/Documentos/Pruebas/Python/Pyvistaplots/.env/lib/python3.12/site-packages/pyvista/plotting/plotter.py", line 677, in export_vtksz
    from pyvista.trame import PyVistaLocalView
  File "/home/manuel/Documentos/Pruebas/Python/Pyvistaplots/.env/lib/python3.12/site-packages/pyvista/trame/__init__.py", line 9, in <module>
    from pyvista.trame.jupyter import elegantly_launch
  File "/home/manuel/Documentos/Pruebas/Python/Pyvistaplots/.env/lib/python3.12/site-packages/pyvista/trame/jupyter.py", line 12, in <module>
    from trame.widgets import vuetify as vuetify2_widgets
ImportError: cannot import name 'vuetify' from 'trame.widgets' (/home/manuel/Documentos/Pruebas/Python/Pyvistaplots/.env/lib/python3.12/site-packages/trame/widgets/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/manuel/Documentos/Pruebas/Python/Pyvistaplots/test_html.py", line 12, in <module>
    pl.export_html('pv.html')  
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/manuel/Documentos/Pruebas/Python/Pyvistaplots/.env/lib/python3.12/site-packages/pyvista/plotting/plotter.py", line 638, in export_html
    data = self.export_vtksz(filename=None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/manuel/Documentos/Pruebas/Python/Pyvistaplots/.env/lib/python3.12/site-packages/pyvista/plotting/plotter.py", line 681, in export_vtksz
    raise ImportError('Please install trame to export')
ImportError: Please install trame to export

My python version is 3.12.6, but I have also tested it in 3.11.2.
Steps to reproduce the bug.
virtualenv test_html_export
source ./test_html_export/bin/activate
pip install trame trame_vtk pyvista
import pyvista as pv
from pyvista import examples
mesh = examples.load_uniform()
pl = pv.Plotter(shape=(1, 2))
_ = pl.add_mesh(
    mesh, scalars='Spatial Point Data', show_edges=True
)
pl.subplot(0, 1)
_ = pl.add_mesh(
    mesh, scalars='Spatial Cell Data', show_edges=True
)
pl.export_html('pv.html')  
System Information
--------------------------------------------------------------------------------
  Date: Fri Nov 22 14:34:00 2024 CET

                OS : Linux (Debian GNU/Linux 12)
            CPU(s) : 6
           Machine : x86_64
      Architecture : 64bit
       Environment : Python
        GPU Vendor : nouveau
      GPU Renderer : NVE7
       GPU Version : 4.3 (Core Profile) Mesa 22.3.6
  MathText Support : True

  Python 3.11.2 (main, Sep 14 2024, 03:00:30) [GCC 12.2.0]

           pyvista : 0.44.1
               vtk : 9.3.1
             numpy : 2.1.3
        matplotlib : 3.9.2
            scooby : 0.10.0
             pooch : 1.8.2
            pillow : 11.0.0
             trame : 3.7.0
      trame_client : 3.5.0
      trame_server : 3.2.3
         trame_vtk : 2.8.12
--------------------------------------------------------------------------------
Screenshots
No response

Duplicate issue #6997: Always says "Please install trame to export" when export to html
Created: 2024-12-17T12:19:32Z
Describe the bug, what's wrong, and what you expected.
I've already installed the trame and trame-vtk, and the version is:
trame == 3.7.1
trame == 2.8.12
but when I export the mesh to html file, it always report a error:
ImportError: Please install trame to export
For the error line is:
try:
from pyvista.trame import PyVistaLocalView
from pyvista.trame.jupyter import elegantly_launch
from pyvista.trame.views import get_server
except ImportError:  # pragma: no cover
raise ImportError('Please install trame to export')
It cannot find the class PyVistaLocalView, but I found it in the pyvista.trame.views file.
Please help with this.
Steps to reproduce the bug.
Insert code here
plotter.export_html('pv.html')
System Information
Traceback (most recent call last):
  File "/xxxx/xxxx/.venv/lib/python3.9/site-packages/pyvista/plotting/plotter.py", line 638, in export_html
    data = self.export_vtksz(filename=None)
  File "/xxxx/xxxx/.venv/lib/python3.9/site-packages/pyvista/plotting/plotter.py", line 681, in export_vtksz
    raise ImportError('Please install trame to export')
ImportError: Please install trame to export
Screenshots

Closing comment (2024-12-18T02:04:22Z): Might be similar to #6841

Yes, it works 👍 waiting for merging to the release version