2

When I use the mayavi (4.3.1) to visualize a mesh, it pronpts the following warning:


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


My system: MS Windows 7 64bits, Anaconda 4.3.1 (latest version),

<code>
$ conda list qt
# packages in environment at C:\ProgramData\Anaconda2:
#
pyqt                      4.11.4                   py27_7    anaconda
qt                        4.8.7                     vc9_9  [vc9]  anaconda
qtawesome                 0.4.3                    py27_0
qtconsole                 4.2.1                    py27_0    anaconda
qtpy                      1.2.1                    py27_0

$ conda list vtk
# packages in environment at C:\ProgramData\Anaconda2:
#
vtk                       5.10.1                   py27_0    anaconda

$ conda list mayavi
# packages in environment at C:\ProgramData\Anaconda2:
#
mayavi                    4.5.0                     <pip>
</code>

I have searched the forums, but most answers regarded it as a bug in VTK 4 years ago, for example, TVTK Error in Mayavi (Python) . I am not sure it has an determined solution. In my computer, indeed there is another version of VTK (version>6) but it is in C++ and has nothing with python and Mayavi.

The error I encountered occurred when I run the Maya sample code, as follows (The warning message is extremely confusing since my VTK is 5.10 (as above) and it is strange where is the version 5.1),

<code>
>>> runfile('D:/flex_8state/code/spherical_harmonics.py', wdir='D:/flex_8state/code')
********************************************************************************
WARNING: Imported VTK version (5.1) does not match the one used
         to build the TVTK classes (6.3). This may cause problems.
         Please rebuild TVTK.
********************************************************************************

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
    execfile(filename, namespace)
  File "C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)
  File "D:/flex_8state/code/spherical_harmonics.py", line 36, in <module>
    mlab.figure(1, bgcolor=(1, 1, 1), fgcolor=(0, 0, 0), size=(400, 300))
  File "C:\ProgramData\Anaconda2\lib\site-packages\mayavi\tools\figure.py", line 85, in figure
    engine.new_scene(name=name, size=size)
  File "C:\ProgramData\Anaconda2\lib\site-packages\apptools\scripting\recordable.py", line 45, in _wrapper
    result = func(*args, **kw)
  File "C:\ProgramData\Anaconda2\lib\site-packages\mayavi\core\engine.py", line 452, in new_scene
    viewer = self.scene_factory(**factory_kwargs)
  File "C:\ProgramData\Anaconda2\lib\site-packages\mayavi\core\ui\mayavi_scene.py", line 89, in viewer_factory
    viewer.open()
  File "C:\ProgramData\Anaconda2\lib\site-packages\pyface\i_window.py", line 166, in open
    self._create()
  File "C:\ProgramData\Anaconda2\lib\site-packages\pyface\ui\qt4\application_window.py", line 121, in _create
    contents = self._create_contents(self.control)
  File "C:\ProgramData\Anaconda2\lib\site-packages\tvtk\tools\ivtk.py", line 404, in _create_contents
    self.scene = self._scene_factory(parent)
  File "C:\ProgramData\Anaconda2\lib\site-packages\mayavi\core\ui\mayavi_scene.py", line 68, in mayavi_scene_factory
    s = MayaviScene(parent, stereo=p['stereo'])
  File "C:\ProgramData\Anaconda2\lib\site-packages\tvtk\pyface\ui\qt4\decorated_scene.py", line 59, in __init__
    super(DecoratedScene, self).__init__(parent, **traits)
  File "C:\ProgramData\Anaconda2\lib\site-packages\tvtk\pyface\ui\qt4\scene.py", line 325, in __init__
    self.picker = picker.Picker(self)
  File "C:\ProgramData\Anaconda2\lib\site-packages\tvtk\pyface\picker.py", line 260, in __init__
    configure_input(self.p_mapper, self.p_source)
  File "C:\ProgramData\Anaconda2\lib\site-packages\tvtk\common.py", line 88, in configure_input
    inp.input = op.output
  File "C:\ProgramData\Anaconda2\lib\site-packages\traits\trait_handlers.py", line 104, in _read_only
    name, class_of( object ) )
traits.trait_errors.TraitError: The 'input' trait of a PolyDataMapper instance is 'read only'.
</code>
Community
  • 1
  • 1
Nico
  • 93
  • 7

1 Answers1

3

After 3-day hard striving, I have found a workaround and I posted here which would be helpful to the similar victims. I strongly suggested the developers of Mayavi/TVTK pay more attention about this bug.

This post helped me much, https://github.com/ContinuumIO/anaconda-issues/issues/1510 . The same initial installation and then update (my initial post) the VTK from 5 to 6, as listed in https://repo.continuum.io/pkgs/free/win-64/ . The intrinsic error rooted in altered SetInputConnection/SetInputData interface across python/VTK versions.

Major concerns

  1. In my notebook PC, the same installation (as the above post) indeed works. I don't why.
  2. In my PC, before reach the workaround, when I directly installed VTK-6 by conda, it didn't work and prompted "...missing modules" (sorry I didn't record these errors).
Nico
  • 93
  • 7
  • It's always okay to accept your own answer. When future readers search (like me) seeing that the question has an accepted answer is a good indicator and will bring more readers. Thanks you! – uhoh May 03 '19 at 09:36