Sage 5.1: Animate command bug
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 image
00000000.png' @ error/png.c/ReadPNGImage/3693.
convert: memory allocation failed 00000001.png' @
error/png.c/ReadOnePNGImage/2105.
convert: corrupt image
00000001.png' @ error/png.c/ReadPNGImage/3693.
convert: memory allocation failed 00000002.png' @
error/png.c/ReadOnePNGImage/2105.
convert: corrupt image
00000002.png' @ error/png.c/ReadPNGImage/3693.
convert: memory allocation failed 00000003.png' @
error/png.c/ReadOnePNGImage/2105.
convert: corrupt image
00000003.png' @ error/png.c/ReadPNGImage/3693.
convert: memory allocation failed 00000004.png' @
error/png.c/ReadOnePNGImage/2105.
convert: corrupt image
00000004.png' @ error/png.c/ReadPNGImage/3693.
convert: memory allocation failed 00000005.png' @
error/png.c/ReadOnePNGImage/2105.
convert: corrupt image
00000005.png' @ error/png.c/ReadPNGImage/3693.
convert: memory allocation failed 00000006.png' @
error/png.c/ReadOnePNGImage/2105.
convert: corrupt image
00000006.png' @ error/png.c/ReadPNGImage/3693.
convert: memory allocation failed 00000007.png' @
error/png.c/ReadOnePNGImage/2105.
convert: corrupt image
00000007.png' @ error/png.c/ReadPNGImage/3693.
convert: memory allocation failed 00000008.png' @
error/png.c/ReadOnePNGImage/2105.
convert: corrupt image
00000008.png' @ error/png.c/ReadPNGImage/3693.
convert: memory allocation failed 00000009.png' @
error/png.c/ReadOnePNGImage/2105.
convert: corrupt image
00000009.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 ...
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.