Ask Your Question
0

Sage 5.1: Animate command bug

asked 2012-07-12 19:17:21 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi all,

I have installed the both the app version and the command line version of the Sage 5.1 on a MacBook Pro running Lion. Also, I have installed the most recent version of ImageMagick and I've set the environment variables as suggested at the ImageMagick website. I also checked that ImageMagick is working!

Sage's 'animate' command fails when invoking either version of Sage 5.1 from the command line and then entering "notebook" command to start the browser version of Sage.

The example is the first one in the 'Animate Plots' section of the Sage's 'Help':

a = animate([circle((i,i), 1-1/(i+1), hue=i/10) for i in srange(0,2,0.2)], xmin=0,ymin=0,xmax=2,ymax=2,figsize=[2,2]) a.show() # optional -- ImageMagick

Below is the error that is reported by Sage:

============================================================================ convert: memory allocation failed 00000000.png' @ error/png.c/ReadOnePNGImage/2105. convert: corrupt image00000000.png' @ error/png.c/ReadPNGImage/3693. convert: memory allocation failed 00000001.png' @ error/png.c/ReadOnePNGImage/2105. convert: corrupt image00000001.png' @ error/png.c/ReadPNGImage/3693. convert: memory allocation failed 00000002.png' @ error/png.c/ReadOnePNGImage/2105. convert: corrupt image00000002.png' @ error/png.c/ReadPNGImage/3693. convert: memory allocation failed 00000003.png' @ error/png.c/ReadOnePNGImage/2105. convert: corrupt image00000003.png' @ error/png.c/ReadPNGImage/3693. convert: memory allocation failed 00000004.png' @ error/png.c/ReadOnePNGImage/2105. convert: corrupt image00000004.png' @ error/png.c/ReadPNGImage/3693. convert: memory allocation failed 00000005.png' @ error/png.c/ReadOnePNGImage/2105. convert: corrupt image00000005.png' @ error/png.c/ReadPNGImage/3693. convert: memory allocation failed 00000006.png' @ error/png.c/ReadOnePNGImage/2105. convert: corrupt image00000006.png' @ error/png.c/ReadPNGImage/3693. convert: memory allocation failed 00000007.png' @ error/png.c/ReadOnePNGImage/2105. convert: corrupt image00000007.png' @ error/png.c/ReadPNGImage/3693. convert: memory allocation failed 00000008.png' @ error/png.c/ReadOnePNGImage/2105. convert: corrupt image00000008.png' @ error/png.c/ReadPNGImage/3693. convert: memory allocation failed 00000009.png' @ error/png.c/ReadOnePNGImage/2105. convert: corrupt image00000009.png' @ error/png.c/ReadPNGImage/3693. convert: no images defined `/private/var/folders/31/r_2f8ryd5ks7xb80nyrbj2cc0000gn/T/tmpbsWwH9/sage\ 0.gif' @ error/convert.c/ConvertImageCommand/3044. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_2.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -- coding: utf-8 --\n" + _support_.preparse_worksheet_cell(base64.b64decode("YSA9IGFuaW1hdGUoW2NpcmNsZSgoaSxpKSwgMS0xLyhpKzEpLCBodWU9aS8xMCkgZm9yIGkgaW4gc3JhbmdlKDAsMiwwLjIpXSwgCiAgICAgICAgICAgICAgIHhtaW49MCx5bWluPTAseG1heD0yLHltYXg9MixmaWdzaXplPVsyLDJdKQphLnNob3coKSAjIG9wdGlvbmFsIC0tIEltYWdlTWFnaWNr"),globals())+"\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module>

File "/private/var/folders/31/r_2f8ryd5ks7xb80nyrbj2cc0000gn/T/tmpyUOMOA/___code___.py", line 5, in <module> exec compile(u'a.show() # optional -- ImageMagick File "", line 1, in <module>

File "/Applications/Sage/local/lib/python2.7/site-packages/sage/plot/animate.py", line 457, in show self.gif(delay = delay, iterations = iterations) File "/Applications/Sage/local/lib/python2.7/site-packages/sage/plot/animate.py", line 400, in gif raise OSError, msg OSError: Error: Neither ImageMagick nor ffmpeg appears to be installed. Saving an animation ... (more)

edit retag flag offensive close merge delete

Comments

It works for me using Snow Leopard and ImageMagick installed via home brew. You can see if it's a permissions issue by checking permissions of `sage.misc.misc.tmp_dir()`. That should also help find the generated pngs (they will be in a sibling directory) and you can see if they are corrupted. I would also try running `convert` from within `sage -sh` since that should mimic the environment used by sage. You may need to use `sage-native-execute convert ...` to reset PATH, and LD_LIBRARY_PATH, etc.

Ivan Andrus gravatar imageIvan Andrus ( 2012-07-12 23:16:02 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-07-13 05:08:26 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi all,

I tried Ivan Andrus's suggestion (see above) and have discovered that there is a problem with the latest version of ImageMagick. When I downgraded to "ImageMagick-6.7.5" from "ImageMagick-6.7.8" (the current version), the "animate" does work in Sage 5.1 when Sage is started from the Terminal !

It seems that "ImageMagick-6.7.8 was built against a different version of "libpng" than was "ImageMagick-6.7.5" and this is causing the memory errors.

Thanks and regards,

Adam Hausknecht Department of Mathematics UMass Dartmouth

edit flag offensive delete link more

Comments

Yikes! That is a nasty thing. Can you give us more details? I think we do assume libpng is on the system, but I don't know that we verify the "right" version. Maybe we need to check this :(

kcrisman gravatar imagekcrisman ( 2012-07-13 16:54:41 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-07-12 19:17:21 -0600

Seen: 377 times

Last updated: Jul 13 '12