4

I am trying to learn MayaVi, but getting stuck on opening figures.

Displaying figures in mlab just results in a segfault. It does not seem to matter what I plot, so I think that the problem is in the act of displaying, not in the object I am trying to display. For example:

import numpy as np
from mayavi import mlab
x = y = np.arange(-5, 5, 1)
s = np.meshgrid(x, y)
mlab.surf(s)

results in the error:

Segmentation fault (core dumped)

I am using Python 2.7.3, EPD 7.3-1 (64-bit) on Linux.

EDIT: I actually get a different error if I try to display an image, which is one of my goals.

import numpy as np
from mayavi import mlab
from PIL import Image
img = Image.open('milkyway.png')
mlab.imshow(img)

results in

Fatal error in __driConfigOptions line 108393789, column 108392770: parsing finished.
Abort (core dumped)

EDIT2: Okay, it is definitely an issue in opening the figures, because if I just test:

from mayavi import mlab
mlab.figure()

I get the initial error (a segfault).

Community
  • 1
  • 1

1 Answers1

0

I'm not using Enthought but I got similar segfault errors and found help here:

https://github.com/enthought/mayavi/issues/450

They say it is a compatibility problem between Qt4 (used by VTK) and Qt5 (used by Mayavi) and recommend switching to wx. To do so, please run the following command in the terminal:

export ETS_TOOLKIT=wx

Then you should be able to run Enthough or your Python from the same terminal.

If that works, you might also consider adding the above line to your ~/.profile.d so that the export is automatically executed when starting the terminal. How this can automatically included in Enthought I don't know, sorry.

I hope that helps, Mayavi is quite nice once it's up running!

David
  • 1,909
  • 1
  • 20
  • 32