Search code examples
pythonmacosmayavi

Mayavi crashes with "Illegal hardware instruction" on MacOS 10.12


Mayavi crashes on my MacOS 10.12. Is there any suggestion?

I installed mayavi and vtk with

$ brew install vtk
$ pip install --user mayavi

and when I run mayavi2 or import mayavi.lab in python2.7, it crashes

$ mayavi2
[1]    93511 illegal hardware instruction  mayavi2

$ python2 -c "import mayavi.mlab"
[1]    93920 illegal hardware instruction  python2 -c "import mayavi.mlab"

Update

I find the problem may be in traitsui.api imported in mayavi.preferences.preference_manager .

$ python2 -c "import traitsui.api"
[1]    2421 illegal hardware instruction  python2 -c "import traitsui.api"

Update2

Going deeper, I find it's about "traits.api.Color"... used in traitsui.editors.code_editor

$ python -c "from traits.api.Color; print 'hi'; Color( 0xECE9D8 )"
hi
[1]    6414 illegal hardware instruction  python2 -c "from traits.api import Color; print 'hi'; Color(0xECE9D8)"

Solution

  • Thank to the suggestion from @PierredeBuyl.

    I tried to reinstall pyqt and it works now!

    The steps are:

    $ brew install pyqt
    Error: pyqt-4.11.3 already installed
    To install this version, first `brew unlink pyqt`
    
    $ brew unlink pyqt
    Unlinking /usr/local/Cellar/pyqt/4.11.3... 78 symlinks removed
    
    $ brew install pyqt
    ...
    
    $ mayavi2    # now it works