ContinuumIO / anaconda-issues

Anaconda issue tracking
648 stars 223 forks source link

Make Mayavi 4.5+ to depend on VTK 6+ #1510

Open mwaskom opened 7 years ago

mwaskom commented 7 years ago

Apologies if this is the wrong place for this.

Installing the current recipe of mayavi on top of an existing environment with VTK 5 fails because mayavi was built with VTK 6. To replicate:

Create a fresh conda environment with only an older VTK:

[mlw-mbair ~]$ conda create -n mayavi_test vtk=5
Fetching package metadata .........
Solving package specifications: .

Package plan for installation in environment /Users/mwaskom/anaconda/envs/mayavi_test:

The following NEW packages will be INSTALLED:

    openssl:    1.0.2k-1
    pip:        9.0.1-py27_1
    python:     2.7.13-0
    readline:   6.2-2
    setuptools: 27.2.0-py27_0
    sqlite:     3.13.0-0
    tk:         8.5.18-0
    vtk:        5.10.1-py27_0
    wheel:      0.29.0-py27_0
    zlib:       1.2.8-3

Proceed ([y]/n)? y

openssl-1.0.2k 100% |################################| Time: 0:00:00   7.64 MB/s
vtk-5.10.1-py2 100% |################################| Time: 0:00:04   7.20 MB/s
#
# To activate this environment, use:
# > source activate mayavi_test
#
# To deactivate this environment, use:
# > source deactivate mayavi_test
#

[mlw-mbair ~]$
[mlw-mbair ~]$ . activate mayavi_test

Install mayavi on top of it:

(mayavi_test) [mlw-mbair ~]$ conda install mayavi
Fetching package metadata .........
Solving package specifications: .

Package plan for installation in environment /Users/mwaskom/anaconda/envs/mayavi_test:

The following NEW packages will be INSTALLED:

    apptools:   4.4.0-py27_0
    configobj:  5.0.6-py27_0
    envisage:   4.5.1-py27_0
    freetype:   2.5.5-2
    libpng:     1.6.27-0
    mayavi:     4.5.0-py27_0
    mkl:        2017.0.1-0
    numpy:      1.12.0-py27_0
    pyface:     5.1.0-py27_0
    pygments:   2.2.0-py27_0
    pyqt:       4.11.4-py27_4
    python.app: 1.2-py27_4
    qt:         4.8.7-4
    sip:        4.18-py27_0
    six:        1.10.0-py27_0
    traits:     4.6.0-py27_0
    traitsui:   5.1.0-py27_0

Proceed ([y]/n)? y

numpy-1.12.0-p 100% |################################| Time: 0:00:00   7.60 MB/s
(mayavi_test) [mlw-mbair ~]$

Fail due to incorrect VTK:

(mayavi_test) [mlw-mbair ~]$ python
Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:05:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> from mayavi import mlab
********************************************************************************
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.
********************************************************************************

>>> mlab.figure()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/mayavi/tools/figure.py", line 68, in figure
    engine.new_scene(name=name, size=size)
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/apptools/scripting/recordable.py", line 45, in _wrapper
    result = func(*args, **kw)
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/mayavi/core/engine.py", line 452, in new_scene
    viewer = self.scene_factory(**factory_kwargs)
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/mayavi/core/ui/mayavi_scene.py", line 89, in viewer_factory
    viewer.open()
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/pyface/i_window.py", line 166, in open
    self._create()
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/pyface/ui/qt4/application_window.py", line 121, in _create
    contents = self._create_contents(self.control)
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/tvtk/tools/ivtk.py", line 404, in _create_contents
    self.scene = self._scene_factory(parent)
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/mayavi/core/ui/mayavi_scene.py", line 68, in mayavi_scene_factory
    s = MayaviScene(parent, stereo=p['stereo'])
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/tvtk/pyface/ui/qt4/decorated_scene.py", line 59, in __init__
    super(DecoratedScene, self).__init__(parent, **traits)
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/tvtk/pyface/ui/qt4/scene.py", line 325, in __init__
    self.picker = picker.Picker(self)
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/tvtk/pyface/picker.py", line 260, in __init__
    configure_input(self.p_mapper, self.p_source)
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/site-packages/tvtk/common.py", line 88, in configure_input
    inp.input = op.output
  File "/Users/mwaskom/anaconda/envs/mayavi_test/lib/python2.7/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'.

Update VTK

(mayavi_test) [mlw-mbair ~]$ conda update vtk
Fetching package metadata .........
Solving package specifications: .

Package plan for installation in environment /Users/mwaskom/anaconda/envs/mayavi_test:

The following packages will be UPDATED:

    vtk: 5.10.1-py27_0 --> 6.3.0-py27_1

Proceed ([y]/n)? y

Succeed in using mayavi:

(mayavi_test) [mlw-mbair ~]$ python
Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:05:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> from mayavi import mlab
>>> mlab.figure()
<mayavi.core.scene.Scene object at 0x120cc4ad0>
mwaskom commented 7 years ago

Is this the wrong place for this issue?

ccordoba12 commented 7 years ago

Nop, it's the right one. So is the solution to require vtk >= 6 for the latest Mayavi?

mwaskom commented 7 years ago

I don't know if it needs to be vtk=6 or if >= is sufficient, but updating from vtk 5 did seem necessary to get it running.

jasmainak commented 7 years ago

This worked for me too! Thanks @mwaskom

mwaskom commented 7 years ago

Apparently on Python 3.6 Mayavi needs VTK 7.1.1: https://github.com/menpo/conda-mayavi/issues/1