Mayavi: Saving of PDF file on OS X 10.11 results in a corrupted zip file being produced

Created on 21 Jun 2016  ·  7Comments  ·  Source: enthought/mayavi

With Mayavi installed through Conda, running the following script in a Jupyter Notebook:

%gui qt
from mayavi import mlab
mlab.test_flow()

then clicking in the GUI to save the scene, if I set the file output as "snapshot.pdf", I get an error message in the terminal that opened the notebook:

2016-06-21 12:03:43.383 python[44385:6652218] modalSession has been exited prematurely - check for a reentrant call to endModalSession:

and no PDF file is created - a file called snapshot.pdf.gz is left.

The environment I'm working in his here:
env.txt

bug

All 7 comments

There are a number of modules that are involved in this procedure and it is not clear from the error output what it the reason of failure.

Can you reproduce the issue without using the notebook from a normal ipython prompt?
Can you reproduce the error using WX?

You should also run the tests (it might help to narrow down the issue)

# probably need to run these from site-packages
python -um nose.core -v tvtk
python -um nose.core -v mayavi

Hi again,

When running the tvtk tests, I have the following error:

ERROR: Test if all the attributes with MinValue/MaxValue are traits

Traceback (most recent call last):
File "/Users/ryan/anaconda3/envs/mayavi/lib/python2.7/site-packages/tvtk/tests/test_tvtk.py", line 917, in test_trait_with_range
vtk_attr_name)
File "/Users/ryan/anaconda3/envs/mayavi/lib/python2.7/site-packages/tvtk/tests/test_tvtk.py", line 899, in get_min_max_value
return (getattr(vtk_klass(), get_min_method)(),
SystemError: error return without exception set


Ran 106 tests in 30.976s

FAILED (SKIP=3, errors=1)

And I don't get any errors on the MayaVi tests.

Trying it from jupyter console I get a slightly different error:

2016-06-21 14:12:20.658 python[45411:6739252] modalSession has been exited prematurely - check for a reentrant call to endModalSession:
GL2PS info: OpenGL feedback buffer overflow

WARNING: The kernel did not respond to an is_complete_request. Setting use_kernel_is_complete to False.

I can't run using Wx as I get the following error when I try to set that as the GUI:

An exception has occurred, use %tb to see the full traceback.

SystemExit: This program needs access to the screen.
Please run with a Framework build of python, and only when you are
logged in on the main display of your Mac.

To exit: use 'exit', 'quit', or Ctrl-D.

Thanks for the info,

Please note that at the moment I do not have a mac os available for testing (I am not a mac user), so if you can try a few more things for me will help me to debug the issue later.

Test if all the attributes with MinValue/MaxValue are traits

Although it is not good to fail tests, I do not think that this error is related to your problem.

Trying it from jupyter console I get a slightly different error:

The error about OpenGL is wierd and it is not clear where it is coming from (no traceback).
Is it possible to run the commands from a python prompt to avoid jupyter console interacting with the Qt application and the output.

I can't run using Wx as I get the following error when I try to set that as the GUI:

I see that you are using wxpython 3.0. Please note that support for python 3.0 was added in traitsui 5.0.0. So I would suggest that since you are using the latest version for mayavi you should also use the latest versions for traitsui, traits and pyface, apptools and envisage.

Finally, the last message (on wx) makes me think that we are running python on a headless machine (or maybe a container) it that true?

Thanks for the help.

update

On windows 10 with python 2.7.10 (64bit) and vtk 6.3 I get a segfault. So it looks that the issue is not related to mac osx. Will provide more info soon.

@ryanpepper it looks that the tvtk.GL2PSExporter() fails when is trying to write the pdf file. It might be a vtk or tvtk bug but will not be able to know for sure without more investigation. The normal ps export should work as a workaround

@itziakos Great, thanks for investigating.

@ryanpepper -- it actually works but looks like there is a strange VTK issue where VTK saves a snapshot.pdf.gz when the file is really a PDF with compressed content so if you just rename the file to snapshot.pdf it should render just fine. If you turn off compression on the dialog that pops up, that will also work but the file will be larger although the file will be saved as a snapshot.pdf. :( I am closing this as this looks like a VTK issue with how it saves the file. One hacky fix would be to test if the file is saved as *.pdf.gz and move it but that seems like a hack but I'll make it. It is part of https://github.com/enthought/mayavi/pull/416 I will push some more fixes to that if needed but for now am closing this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aestrivex picture aestrivex  ·  9Comments

relyativist picture relyativist  ·  16Comments

jmp75 picture jmp75  ·  27Comments

stefanoborini picture stefanoborini  ·  11Comments

Make42 picture Make42  ·  7Comments