Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with VTK 9.3.0 #1286

Open
lciorciaro opened this issue Jan 5, 2024 · 2 comments
Open

Error with VTK 9.3.0 #1286

lciorciaro opened this issue Jan 5, 2024 · 2 comments

Comments

@lciorciaro
Copy link

lciorciaro commented Jan 5, 2024

VTK version 9.3.0 produces an error in mayavi. The following code

from mayavi import mlab
import numpy as np

x = np.array([1, 1, 1, 2, 2, 2, 3, 3, 3])
y = np.array([11, 12, 13, 11, 12, 13, 11, 12, 13])
vs = np.array([5] * len(x))

fig = mlab.figure(1, fgcolor=(0, 0, 0), bgcolor=(1, 1, 1), size=(1400, 1900))

pts = mlab.points3d(x, y, vs, vs, scale_mode='none', scale_factor=0.2, figure=fig)

mlab.view(azimuth=8, elevation=65, distance=65)
mlab.show()

produces the error

Traceback (most recent call last):
  File "~/mayavi_test.py", line 10, in <module>
    pts = mlab.points3d(x, y, vs, vs, scale_mode='none', scale_factor=0.2, figure=fig)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/venv/lib/python3.11/site-packages/mayavi/tools/helper_functions.py", line 38, in the_function
    return pipeline(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/venv/lib/python3.11/site-packages/mayavi/tools/helper_functions.py", line 83, in __call__
    output = self.__call_internal__(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/venv/lib/python3.11/site-packages/mayavi/tools/helper_functions.py", line 178, in __call_internal__
    g = Pipeline.__call_internal__(self, *args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/venv/lib/python3.11/site-packages/mayavi/tools/helper_functions.py", line 96, in __call_internal__
    return self.build_pipeline()
           ^^^^^^^^^^^^^^^^^^^^^
  File "~/venv/lib/python3.11/site-packages/mayavi/tools/helper_functions.py", line 124, in build_pipeline
    object = pipe(object, **this_kwargs)._target
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/venv/lib/python3.11/site-packages/mayavi/tools/modules.py", line 162, in __init__
    super(DataModuleFactory, self).__init__(*args, **kwargs)
  File "~/venv/lib/python3.11/site-packages/mayavi/tools/pipe_base.py", line 146, in __init__
    if issubclass(self._target.__class__, Filter):
                  ^^^^^^^^^^^^
  File "~/venv/lib/python3.11/site-packages/traits/trait_types.py", line 3673, in create_default_value
    return klass(*args[1:], **kw)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "~/venv/lib/python3.11/site-packages/mayavi/core/module.py", line 58, in __init__
    self.setup_pipeline()
  File "~/venv/lib/python3.11/site-packages/mayavi/modules/glyph.py", line 66, in setup_pipeline
    self.glyph = glyph.Glyph(scale_mode='scale_by_scalar',
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/venv/lib/python3.11/site-packages/mayavi/core/component.py", line 36, in __init__
    self.setup_pipeline()
  File "~/venv/lib/python3.11/site-packages/mayavi/components/glyph.py", line 157, in setup_pipeline
    self.glyph_source = glyph_source.GlyphSource()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/venv/lib/python3.11/site-packages/mayavi/core/component.py", line 36, in __init__
    self.setup_pipeline()
  File "~/venv/lib/python3.11/site-packages/mayavi/components/glyph_source.py", line 128, in setup_pipeline
    self.glyph_source = self.glyph_dict['glyph_source2d']
                        ^^^^^^^^^^^^^^^
  File "~/venv/lib/python3.11/site-packages/mayavi/components/glyph_source.py", line 257, in _glyph_dict_default
    'cylinder_source': tvtk.CylinderSource(height=1.0, radius=0.15,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "tvtk_classes/cylinder_source.py", line 55, in __init__
  File "~/venv/lib/python3.11/site-packages/tvtk/tvtk_base.py", line 432, in __init__
    self.update_traits()
  File "~/venv/lib/python3.11/site-packages/tvtk/tvtk_base.py", line 585, in update_traits
    setattr(self, name, val)
  File "~/venv/lib/python3.11/site-packages/traits/base_trait_handler.py", line 74, in error
    raise TraitError(
traits.trait_errors.TraitError: The 'lat_long_tessellation' trait of a CylinderSource instance must be 'f' or 'false' or 'n' or 'no' or 'off' or 'on' or 't' or 'true' or 'y' or 'yes' or -1 or 0 or 1, but a value of 32713 <class 'int'> was specified.

Under VTK version 9.2.6 everything works for me.

@allucas
Copy link

allucas commented Jan 21, 2024

I am having the same issue, unfortunately if I go down to VTK 9.2.6, then I get a mismatch between TVTK (VTK=9.3) and VTK (VTK=9.2.6), and other parts of the application I have fail.

@VoodooCode14
Copy link

I'm also facing this issue and I was able to isolate it to the "mayavi.mlab.points3d" call.

yoda-vid added a commit to sanderslab/magellanmapper that referenced this issue Jan 30, 2024
Install only VTK < 9.3 because of errors associated with VTK's latest update in the current Mayavi (4.8.1; see enthought/mayavi#1286).
yoda-vid added a commit to sanderslab/magellanmapper that referenced this issue Jan 30, 2024
Install only VTK < 9.3 because of errors associated with VTK's latest update in the current Mayavi (4.8.1; see enthought/mayavi#1286).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants