Saving of PDF file on OS X 10.11 results in a corrupted zip file being produced #397

Closed
rpep opened this Issue Jun 21, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@rpep
Contributor

rpep commented Jun 21, 2016

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

@itziakos

This comment has been minimized.

Show comment
Hide comment
@itziakos

itziakos Jun 21, 2016

Member

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
Member

itziakos commented Jun 21, 2016

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
@rpep

This comment has been minimized.

Show comment
Hide comment
@rpep

rpep Jun 21, 2016

Contributor

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.

Contributor

rpep commented Jun 21, 2016

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.

@itziakos

This comment has been minimized.

Show comment
Hide comment
@itziakos

itziakos Jun 21, 2016

Member

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.

Member

itziakos commented Jun 21, 2016

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.

@itziakos

This comment has been minimized.

Show comment
Hide comment
@itziakos

itziakos Jun 21, 2016

Member

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.

Member

itziakos commented Jun 21, 2016

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.

@itziakos itziakos added the bug label Jun 21, 2016

@itziakos

This comment has been minimized.

Show comment
Hide comment
@itziakos

itziakos Jun 21, 2016

Member

@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

Member

itziakos commented Jun 21, 2016

@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

@rpep

This comment has been minimized.

Show comment
Hide comment
@rpep

rpep Jun 22, 2016

Contributor

@itziakos Great, thanks for investigating.

Contributor

rpep commented Jun 22, 2016

@itziakos Great, thanks for investigating.

prabhuramachandran added a commit to prabhuramachandran/mayavi that referenced this issue Jul 26, 2016

@prabhuramachandran

This comment has been minimized.

Show comment
Hide comment
@prabhuramachandran

prabhuramachandran Jul 26, 2016

Member

@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 #416 I will push some more fixes to that if needed but for now am closing this issue.

Member

prabhuramachandran commented Jul 26, 2016

@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 #416 I will push some more fixes to that if needed but for now am closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment