enthought/mayavi

Not able to solve the TVTK problem

theJazzman42 opened this issue · 7 comments


WARNING: Imported VTK version (9.2) does not match the one used
to build the TVTK classes (7.1). This may cause problems.
Please rebuild TVTK.


Tried to install the binary package of the distribution as well as getting from git.

Linux Mint 21.1 64bit Cinnamon

Linux PowerStation 5.15.0-70-generic #77-Ubuntu SMP Tue Mar 21 14:02:37 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
python3 -V
Python 3.10.6
pip show vtk
Name: vtk
Version: 9.2.6
Summ
/ary: VTK is an open-source toolkit for 3D computer graphics, image processing, and visualization
Home-page: https://vtk.org
Author: VTK developers
Author-email: 
License: BSD
Location: /usr/local/lib/python3.10/dist-packages
Requires: matplotlib
Required-by: mayavi

Mint installed from repositories:

vtk7.1   7.1.1
vtk9.1   9.1.0

And I always get

/usr/bin/mayavi2 
18:25:49: Debug: Adding duplicate image handler for 'Windows bitmap file'
18:25:50: Debug: Adding duplicate image handler for 'Windows bitmap file'
18:25:56: Debug: Adding duplicate image handler for 'Windows bitmap file'
********************************************************************************
WARNING: Imported VTK version (9.2) does not match the one used
         to build the TVTK classes (7.1). This may cause problems.
         Please rebuild TVTK.
********************************************************************************

Traceback (most recent call last):
  File "/usr/bin/mayavi2", line 613, in <module>
    main()
  File "/usr/bin/mayavi2", line 602, in main
    mayavi.main(sys.argv[1:])
  File "/usr/local/lib/python3.10/dist-packages/mayavi/plugins/app.py", line 197, in main
    app.run()
  File "/usr/local/lib/python3.10/dist-packages/mayavi/plugins/mayavi_workbench_application.py", line 81, in run
    window.open()
  File "/usr/lib/python3/dist-packages/pyface/workbench/workbench_window.py", line 159, in open
    self._create()
  File "/usr/lib/python3/dist-packages/pyface/ui/wx/application_window.py", line 124, in _create
    self._create_trim_widgets(self.control)
  File "/usr/lib/python3/dist-packages/pyface/i_application_window.py", line 151, in _create_trim_widgets
    self._create_menu_bar(parent)
  File "/usr/lib/python3/dist-packages/pyface/ui/wx/application_window.py", line 73, in _create_menu_bar
    menu_bar = self.menu_bar_manager.create_menu_bar(parent)
  File "/usr/lib/python3/dist-packages/pyface/workbench/action/menu_bar_manager.py", line 38, in create_menu_bar
    menu_bar = super().create_menu_bar(parent, controller=controller)
  File "/usr/lib/python3/dist-packages/pyface/ui/wx/action/menu_bar_manager.py", line 44, in create_menu_bar
    menu = item.create_menu(parent, controller)
  File "/usr/lib/python3/dist-packages/pyface/ui/wx/action/menu_manager.py", line 56, in create_menu
    return _Menu(self, parent, controller)
  File "/usr/lib/python3/dist-packages/pyface/ui/wx/action/menu_manager.py", line 106, in __init__
    self.refresh()
  File "/usr/lib/python3/dist-packages/pyface/ui/wx/action/menu_manager.py", line 152, in refresh
    previous_non_empty_group = self._add_group(
  File "/usr/lib/python3/dist-packages/pyface/ui/wx/action/menu_manager.py", line 210, in _add_group
    item.add_to_menu(parent, self, self._controller)
  File "/usr/lib/python3/dist-packages/pyface/ui/wx/action/menu_manager.py", line 66, in add_to_menu
    id = sub.GetId()
AttributeError: '_Menu' object has no attribute 'GetId'
wx._core.wxAssertionError: C++ assertion "GetEventHandler() == this" failed at ../src/common/wincmn.cpp(477) in ~wxWindowBase(): any pushed event handlers must have been removed

The above exception was the direct cause of the following exception:

SystemError: <class 'wx._core.WindowDestroyEvent'> returned a result with an exception set
Exception ignored in atexit callback: <built-in function _wxPyCleanup>
wx._core.wxAssertionError: C++ assertion "GetEventHandler() == this" failed at ../src/common/wincmn.cpp(477) in ~wxWindowBase(): any pushed event handlers must have been removed

mayavi2 -t
----------------------------------------------------------------------
Running TVTK tests.
Traceback (most recent call last):
  File "/usr/local/bin/mayavi2", line 5, in <module>
    from mayavi.scripts.mayavi2 import main
  File "/usr/local/lib/python3.10/dist-packages/mayavi/scripts/mayavi2.py", line 425, in <module>
    runtests.main()
  File "/usr/local/lib/python3.10/dist-packages/mayavi/tests/runtests.py", line 223, in main
    status = m2_tests(verbose)
  File "/usr/local/lib/python3.10/dist-packages/mayavi/tests/runtests.py", line 177, in m2_tests
    err = run(tests, verbose)
  File "/usr/local/lib/python3.10/dist-packages/mayavi/tests/runtests.py", line 122, in run
    res = re.search(r'Ran\s*(\d*)\s*test', err)
  File "/usr/lib/python3.10/re.py", line 200, in search
    return _compile(pattern, flags).search(string)
TypeError: cannot use a string pattern on a bytes-like object

/usr/bin/mayavi2 -t
----------------------------------------------------------------------
Running TVTK tests.
Traceback (most recent call last):
  File "/usr/bin/mayavi2", line 427, in <module>
    runtests.main()
  File "/usr/local/lib/python3.10/dist-packages/mayavi/tests/runtests.py", line 223, in main
    status = m2_tests(verbose)
  File "/usr/local/lib/python3.10/dist-packages/mayavi/tests/runtests.py", line 177, in m2_tests
    err = run(tests, verbose)
  File "/usr/local/lib/python3.10/dist-packages/mayavi/tests/runtests.py", line 122, in run
    res = re.search(r'Ran\s*(\d*)\s*test', err)
  File "/usr/lib/python3.10/re.py", line 200, in search
    return _compile(pattern, flags).search(string)
TypeError: cannot use a string pattern on a bytes-like object

Just the same with MX Linux.

mayavi2 -t
----------------------------------------------------------------------
Running TVTK tests.
Traceback (most recent call last):
  File "/usr/bin/mayavi2", line 427, in <module>
    runtests.main()
  File "/usr/lib/python3/dist-packages/mayavi/tests/runtests.py", line 225, in main
    status = m2_tests(verbose)
  File "/usr/lib/python3/dist-packages/mayavi/tests/runtests.py", line 179, in m2_tests
    err = run(tests, verbose)
  File "/usr/lib/python3/dist-packages/mayavi/tests/runtests.py", line 124, in run
    res = re.search('Ran\s*(\d*)\s*test', err)
  File "/usr/lib/python3.9/re.py", line 201, in search
    return _compile(pattern, flags).search(string)
TypeError: cannot use a string pattern on a bytes-like object

Could you please uninstall the VTK 7.1 version and try? something looks wrong in your installation. It may be best to try this in a fresh venv.

No changes.

An isolated venv should not have these problems, something is messed up with your system installation. You shouldn't need any of the VTK packages from mint instead pip install vtk should work. Avoid installing python packages into the system python, instead create an isolated environment.