ContinuumIO / anaconda-issues

Anaconda issue tracking
648 stars 223 forks source link

Mayavi crashes with pyface #187

Open moorepants opened 10 years ago

moorepants commented 10 years ago

I tried this example from the mayavi docs:

http://docs.enthought.com/mayavi/mayavi/auto/example_mlab_interactive_dialog.html#example-mlab-interactive-dialog

I get this error:

(bicycleparameters-dev)moorepants@moorepants-2170p:BicycleParameters(update-yeadon)$ python test_mayavi.py 
Traceback (most recent call last):
  File "test_mayavi.py", line 29, in <module>
    class MyModel(HasTraits):
  File "test_mayavi.py", line 51, in MyModel
    view = View(Item('scene', editor=SceneEditor(scene_class=MayaviScene),
  File "/home/moorepants/anaconda/envs/bicycleparameters-dev/lib/python2.7/site-packages/tvtk/pyface/toolkit.py", line 87, in __init__
    raise NotImplementedError("the %s pyface backend doesn't implement %s" % (be, oname))
NotImplementedError: the tvtk.pyface.ui.null. pyface backend doesn't implement SceneEditor

Info:

(bicycleparameters-dev)moorepants@moorepants-2170p:BicycleParameters(update-yeadon)$ conda info
Current conda install:

             platform : linux-64
        conda version : 3.7.0
  conda-build version : 1.3.3
       python version : 2.7.8.final.0
     requests version : 2.4.1
     root environment : /home/moorepants/anaconda  (writable)
  default environment : /home/moorepants/anaconda/envs/bicycleparameters-dev
     envs directories : /home/moorepants/anaconda/envs
        package cache : /home/moorepants/anaconda/pkgs
         channel URLs : http://repo.continuum.io/pkgs/free/linux-64/
                        https://conda.binstar.org/moorepants/linux-64/
          config file : /home/moorepants/.condarc
    is foreign system : False

(bicycleparameters-dev)moorepants@moorepants-2170p:BicycleParameters(update-yeadon)$ conda list
# packages in environment at /home/moorepants/anaconda/envs/bicycleparameters-dev:
#
apptools                  4.2.1                    py27_0  
cairo                     1.12.2                        2  
configobj                 5.0.6                    py27_0  
dateutil                  2.1                      py27_2  
dynamicisttoolkit (/home/moorepants/src/DynamicistToolKit) 0.3.4                     <pip>
envisage                  4.4.0                    py27_1  
freetype                  2.4.10                        0  
ipython                   2.3.0                    py27_0  
libpng                    1.5.13                        1  
matplotlib                1.4.0                np19py27_0  
mayavi                    4.3.1                np19py27_1  
numpy                     1.9.0                    py27_0  
openssl                   1.0.1h                        1  
pip                       1.5.6                    py27_0  
pixman                    0.26.2                        0  
py2cairo                  1.10.0                   py27_1  
pyface                    4.4.0                    py27_0  
pyparsing                 2.0.1                    py27_0  
pyqt                      4.10.4                   py27_0  
pyside                    1.1.2                    py27_0  
python                    2.7.8                         1  
python-dateutil           1.5                       <pip>
pytz                      2014.7                   py27_0  
pyyaml                    3.11                     py27_0  
qt                        4.8.5                         0  
readline                  6.2                           2  
scipy                     0.14.0               np19py27_0  
setuptools                5.8                      py27_0  
shiboken                  1.2.1                    py27_0  
sip                       4.15.5                   py27_0  
six                       1.8.0                    py27_0  
sqlite                    3.8.4.1                       0  
system                    5.8                           1  
tk                        8.5.15                        0  
traits                    4.4.0                    py27_0  
traitsui                  4.4.0                    py27_0  
uncertainties             1.9.1                     <pip>
vtk                       5.10.1                   py27_1  
wsgiref                   0.1.2                     <pip>
yaml                      0.1.4                         0  
zlib                      1.2.7                         0  
moorepants commented 10 years ago

This example works with the wxpython backend.

larsoner commented 8 years ago

This issue recently resurfaced with our CI builds that have been stable for months. In the last ~24 hours they started giving this same error. Did something change with packaging at the conda end in terms of which Qt backend gets pulled in with traits, or was a package updated?

csoja commented 8 years ago

@ccordoba12 @ilanschnell May be related to the qt/pyqt changes of late?

ccordoba12 commented 8 years ago

It could. @moorepants, could you try again? It should be fixed now :-)

larsoner commented 8 years ago

It looks like our CI builds are passing again, thanks!

adelavega commented 8 years ago

Does somebody mind explaining how/why this issue came up? And perhaps how it was fixed?

I'm having a similar issue with conda 4.2.9. Using a package (pysurfer) that uses Mayavai with the qt backend, I get the error:

 NotImplementedError: the tvtk.pyface.ui.null. pyface backend doesn't implement SceneEditor

Would downgrading to prior to when said "qt/pyqt changes of late" changes were made fix the issue? Or is there a nightly build of anaconda available?

moorepants commented 7 years ago

I just updated all of my conda packages with:

moorepants@garuda:~$ conda list mayavi
# packages in environment at /home/moorepants/miniconda3:
#
mayavi                    4.5.0               np112py35_2    conda-forge
moorepants@garuda:~$ conda list vtk
# packages in environment at /home/moorepants/miniconda3:
#
vtk                       7.1.1                  py35_202    conda-forge
moorepants@garuda:~$ conda list pyqt
# packages in environment at /home/moorepants/miniconda3:
#
pyqt                      4.11.4                   py35_2    conda-forge
moorepants@garuda:~$ conda list pyface
# packages in environment at /home/moorepants/miniconda3:
#
pyface                    5.1.0                    py35_1    conda-forge

The example mentioned in the opening of this issue now seg faults:

moorepants@garuda:~$ ipython
Python 3.5.4 | packaged by conda-forge | (default, Aug 10 2017, 01:38:41) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: %paste
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Copyright (c) 2008, Enthought, Inc.
# License: BSD Style.

from numpy import arange, pi, cos, sin

from traits.api import HasTraits, Range, Instance, \
        on_trait_change
from traitsui.api import View, Item, Group

from mayavi.core.api import PipelineBase
from mayavi.core.ui.api import MayaviScene, SceneEditor, \
                MlabSceneModel

dphi = pi/1000.
phi = arange(0.0, 2*pi + 0.5*dphi, dphi, 'd')

def curve(n_mer, n_long):
    mu = phi*n_mer
    x = cos(mu) * (1 + cos(n_long * mu/n_mer)*0.5)
    y = sin(mu) * (1 + cos(n_long * mu/n_mer)*0.5)
    z = 0.5 * sin(n_long*mu/n_mer)
    t = sin(mu)
    return x, y, z, t

class MyModel(HasTraits):
    n_meridional    = Range(0, 30, 6, )#mode='spinner')
    n_longitudinal  = Range(0, 30, 11, )#mode='spinner')

    scene = Instance(MlabSceneModel, ())

    plot = Instance(PipelineBase)

    # When the scene is activated, or when the parameters are changed, we
    # update the plot.
    @on_trait_change('n_meridional,n_longitudinal,scene.activated')
    def update_plot(self):
        x, y, z, t = curve(self.n_meridional, self.n_longitudinal)
        if self.plot is None:
            self.plot = self.scene.mlab.plot3d(x, y, z, t,
                                tube_radius=0.025, colormap='Spectral')
        else:
            self.plot.mlab_source.set(x=x, y=y, z=z, scalars=t)

    # The layout of the dialog created
    view = View(Item('scene', editor=SceneEditor(scene_class=MayaviScene),
                     height=250, width=300, show_label=False),
                Group(
                        '_', 'n_meridional', 'n_longitudinal',
                     ),
                resizable=True,
                )

my_model = MyModel()
my_model.configure_traits()

## -- End pasted text --
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
ERROR: In ../Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 628
vtkXOpenGLRenderWindow (0x492f260): GLEW could not be initialized.

Segmentation fault (core dumped)
ktavabi commented 3 years ago

FWIW The example script @moorepants returns...

NotImplementedError: the null tvtk.pyface.ui.null backend doesn't implement scene_editor:SceneEditor

On this particular build...

Platform: macOS-10.16-x86_64-i386-64bit Python: 3.8.5 (default, Sep 4 2020, 02:22:02) [Clang 10.0.0 ] Executable: ../miniconda3/envs/sci/bin/python3.8 CPU: i386: 12 cores Memory: Unavailable (requires "psutil" package) mne: 0.22.dev0 numpy: 1.19.4 {blas=openblas, lapack=openblas} scipy: 1.5.4 matplotlib: 3.3.3 {backend=module://ipykernel.pylab.backend_inline}

sklearn: Not found numba: Not found nibabel: 3.2.0 cupy: Not found pandas: Not found dipy: Not found mayavi: 4.7.3.dev0 pyvista: Not found vtk: 9.0.1 PyQt5: Not found

conda version : 4.9.2 conda-build version : not installed python version : 3.7.9.final.0 virtual packages : osx=10.16=0 unix=0=0 __archspec=1=x86_64

Also, this build using ipy backend in a Jupyter notebook kernel appears to work as expected with test call

from mayavi import mlab
mlab.init_notebook()
mlab.test_contour3d()
larsoner commented 3 years ago

10.16 is an alias for Big Sur, right? It seems that PyQt5 / Qt5 is not yet Big Sur compatible:

https://github.com/matplotlib/matplotlib/issues/18954 https://bugreports.qt.io/browse/QTBUG-85546

At least I upgraded two days ago, and since then all Qt5 windows (PyQt5 and pyside2) don't show up, and the PyQt5 ones freeze my interpreter.

So maybe the null backend stuff really has to do with upstream libraries / backends not working properly.

ktavabi commented 3 years ago

10.16 is an alias for Big Sur, right?

Yes. The rest of all the Qt5/traits/py -face/-side, vtk, etc. business after OS updates are way out of my wheelhouse - I usually just pray it doesn't affect other NIX platforms 😨

So maybe the null backend stuff really has to do with upstream libraries / backends not working properly.

My knee jerk is always blaming the 'backend'.