JuliaPlots / Plots.jl

Powerful convenience for Julia visualizations and data analysis
https://docs.juliaplots.org
Other
1.84k stars 355 forks source link

Animation errors with plotlyjs and pyplot backends #489

Closed rand5 closed 7 years ago

rand5 commented 8 years ago

I am trying out the Lorenz example on the home page as I have seen others do. I tried it with both the pyplot() and plotlyjs() backends.

With plotlyjs(), the first time through, I hit an error and was prompted to install the Rsvg package, which I did. Rerunning the example then produced the following error:

INFO: Recompiling stale cache file C:\Users\X\.julia\lib\v0.4\Gtk.ji for module Gtk.
LoadError: MethodError: `handle_new_from_data` has no method matching handle_new_from_data(::Dict{UTF8String,Any})
while loading In[21], in expression starting on line 13

 in savefig at C:\Users\X\.julia\v0.4\PlotlyJS\src\savefig.jl:151
 in savefig at C:\Users\X\.julia\v0.4\PlotlyJS\src\savefig.jl:191
 in writemime at C:\Users\X\.julia\v0.4\Plots\src\output.jl:161
 in png at C:\Users\X\.julia\v0.4\Plots\src\output.jl:8
 in frame at C:\Users\X\.julia\v0.4\Plots\src\animation.jl:15
 in frame at C:\Users\X\.julia\v0.4\Plots\src\animation.jl:13
 [inlined code] from C:\Users\X\.julia\v0.4\Plots\src\animation.jl:97
 in anonymous at C:\Users\X\.julia\v0.4\Plots\src\animation.jl:107

Not clear to me what to do about this.

With the pyplot backend, I get a long string of libpng error: Write Error followed by

liWARNING: Tried to create gif using convert (ImageMagick), but got error: ErrorException("failed process: Process(`convert -delay 5 -loop 0 'C:\\Users\\X\\AppData\\Local\\Temp\\julE565.tmp\\*.png' -alpha off 'C:\\Users\\X\\tmp.gif'`, ProcessExited(4)) [4]")
ImageMagick can be installed by executing `Pkg.add("ImageMagick")`
Will try ffmpeg, but it's lower quality...)
LoadError: could not spawn `ffmpeg -v 0 -framerate 20 -i 'C:\Users\X\AppData\Local\Temp\julE565.tmp/%06d.png' -y 'C:\Users\X\tmp.gif'`: no such file or directory (ENOENT)
while loading In[23], in expression starting on line 13

 in _jl_spawn at process.jl:262

After adding ImageMagick and updating all my packages, I still get the same error.

I am using Julia 0.4.6 and Plots 0.8.2 Do the animation examples only work in the dev version of Plots?

It may also be worth adding that I have ImageMagick 0.1.7 and am working in IJulia

cluoma commented 8 years ago

Also getting a similar error, even after adding the ImageMagick package. However it seems unrelated to Plotly since I'm using PyPlot as the backend. Windows 7 Julia 0.5.0 Plots 0.9.3 ImageMagick 0.1.8

cluoma commented 8 years ago

Somewhat fixed by installing the latest version of ImageMagick for Windows and adding the installation directory to my PATH.

Still have the following issues: The latest version of ImageMagick doesn't contain the executable 'convert.exe'. Renaming 'magick.exe' into 'convert.exe' seems to work but seems like a bad idea. The run command to covert uses single quotes instead of double quotes which ImageMagick doesn't seem to like. I suppose these issues are from the ImageMagick.jl package instead of Plots.jl though.

ChrisRackauckas commented 8 years ago

@rand5 Windows? If so, then it's the same as tbreloff/Plots.jl#516. In there I showed that this is an upstream problem: ImageMagick.jl doesn't give you a build error even though the build actually errors. You may want to check that issue in more detail and comment on JuliaIO/ImageMagick.jl#52.

rand5 commented 8 years ago

@ChrisRackauckas Yes, Windows. Thanks for bringing that to my attention! Not sure how I missed it. I will go through tbreloff/Plots.jl#516 in detail.

cluoma commented 8 years ago

@ChrisRackauckas Worked for me. Thanks!

rand5 commented 8 years ago

@ChrisRackauckas Just wanted to follow up on this because I am still having issues after going through tbreloff/Plots.jl#516.

Below is a description of what I did, and I am hoping there is a glaring mistake somewhere that you or others can spot:

Starting clean- uninstalled ImageMagick and deleted ImageMagick folder in C:\Users\Rand5\.julia\v0.5 Open Julia V0.5.0 prompt and called,

Pkg.clone("https://github.com/JuliaIO/ImageMagick.jl.git") Pkg.build("ImageMagick")

This executed without error, as expected. I then tried the Lorenz attractor gif example from Plots.jl, which failed (as expected) with the following error:

WARNING: Tried to create gif using convert (ImageMagick), but got error: ErrorException("failed process: Process(convert -delay 5 -loop 0 'C:\\Users\\Rand5\\AppData\\Local\\Temp\\jl_526B.tmp\\*.png' -alpha off 'C:\\Users\\Rand5\\tmp.gif', ProcessExited(4)) [4]") ImageMagick can be installed by executing Pkg.add("ImageMagick") Will try ffmpeg, but it's lower quality...) LoadError: failed process: Process(ffmpeg -v 0 -framerate 20 -loop 0 -i 'C:\Users\Rand5\AppData\Local\Temp\jl_526B.tmp/%06d.png' -y 'C:\Users\Rand5\tmp.gif', ProcessExited(1)) [1] while loading In[7], in expression starting on line 1 in pipeline_error(::Base.Process) at .\process.jl:616 in run at .\process.jl:592 [inlined] in #gif#325(::Int64, ::Int64, ::Function, ::Plots.Animation, ::String) at C:\Users\Rand5.julia\v0.5\Plots\src\animation.jl:47 in gif(::Plots.Animation) at C:\Users\Rand5.julia\v0.5\Plots\src\animation.jl:28 in macro expansion; at C:\Users\Rand5.julia\v0.5\Plots\src\animation.jl:108 [inlined] in anonymous at .:?

Based on tbreloff/Plots.jl#516, I then went to C:\Users\Rand5\.julia\v0.5\ImageMagick\deps\downloads and installed ImageMagick using the ImageMagick-6.9.6-2-Q16-x64-dll.exe binary.

During installation, the “Add application directory to your system path” box was checked. I then tested the installation as recommended by opening the command prompt and typing,

Convert wizard: wizard.jpg Convert wizard.jpg win:

And the expected result occurred. Restarted computer. C:\Program Files\ImageMagick-6.9.6-Q16 has been added to the System Variables Path.

Back in Julia, running Pkg.build("ImageMagick") returned,

INFO: Building ImageMagick WARNING: Base.WORD_SIZE is deprecated. likely near C:\Users\Rand5.julia\v0.5\ImageMagick\deps\build.jl:42 INFO: Installing ImageMagick library

as expected based on tbreloff/Plots.jl#516. Rerunning the Lorenz attractor code then produced the same error as before, i.e.

WARNING: Tried to create gif using convert (ImageMagick), but got error: ErrorException("failed process: Process(convert -delay 5 -loop 0 'C:\\Users\\Rand5\\AppData\\Local\\Temp\\jl_EFF.tmp\\*.png' -alpha off 'C:\\Users\\Rand5\\tmp.gif', ProcessExited(1)) [1]") ImageMagick can be installed by executing Pkg.add("ImageMagick") Will try ffmpeg, but it's lower quality...) LoadError: failed process: Process(ffmpeg -v 0 -framerate 20 -loop 0 -i 'C:\Users\Rand5\AppData\Local\Temp\jl_EFF.tmp/%06d.png' -y 'C:\Users\Rand5\tmp.gif', ProcessExited(1)) [1] while loading In[5], in expression starting on line 1 in pipeline_error(::Base.Process) at .\process.jl:616 in run at .\process.jl:592 [inlined] in #gif#325(::Int64, ::Int64, ::Function, ::Plots.Animation, ::String) at C:\Users\Rand5.julia\v0.5\Plots\src\animation.jl:47 in gif(::Plots.Animation) at C:\Users\Rand5.julia\v0.5\Plots\src\animation.jl:28 in macro expansion; at C:\Users\Rand5.julia\v0.5\Plots\src\animation.jl:108 [inlined] in anonymous at .:?

I then explicitly added C:\Program Files\ImageMagick-6.9.6-Q16\convert to the System Variables Path. Rebuilding ImageMagick and testing the Lorenz code produced the same error.

I then tried renaming the install directory from C:\Program Files\ImageMagick-6.9.6-Q16 to C:\Program Files\ImageMagick and updating the System Variables Path from C:\Program Files\ImageMagick-6.9.6-Q16\convert to C:\Program Files\ImageMagick\convert. Rebuilding ImageMagick and testing the Lorenz code produced the same error.

ChrisRackauckas commented 8 years ago

Below is a description of what I did, and I am hoping there is a glaring mistake somewhere that you or others can spot

Nah, I don't see an error in there. Peculiar.

sglyon commented 8 years ago

@rand5 the issue with handle_new_from_data not being defined should be resolved on the latest master of PlotlyJS.jl

rand5 commented 8 years ago

Thanks @spencerlyon2 . I just checked out the master of PlotlyJS.jl and reran the Lorenz example. Error I am now getting is,

LoadError: type Array has no field surf while loading In[11], in expression starting on line 1 in _series_updated(::Plots.Plot{Plots.PlotlyJSBackend}, ::Plots.Series) at C:\Users\rand5.julia\v0.5\Plots\src\backends\plotlyjs.jl:62 in setxyz!(::Plots.Plot{Plots.PlotlyJSBackend}, ::Tuple{Array{Float64,1},Array{Float64,1},Array{Float64,1}}, ::Int64) at C:\Users\rand5.julia\v0.5\Plots\src\utils.jl:671 in push!(::Plots.Plot{Plots.PlotlyJSBackend}, ::Int64, ::Float64, ::Float64, ::Float64) at C:\Users\rand5.julia\v0.5\Plots\src\utils.jl:785 in push!(::Plots.Plot{Plots.PlotlyJSBackend}, ::Float64, ::Float64, ::Float64) at C:\Users\rand5.julia\v0.5\Plots\src\utils.jl:750 in macro expansion; at .\In[11]:5 [inlined] in macro expansion; at C:\Users\rand5.julia\v0.5\Plots\src\animation.jl:134 [inlined] in anonymous at .:?

sglyon commented 8 years ago

This error looks like it is inside Plots.jl -- I'll defer to @tbreloff here

tbreloff commented 8 years ago

That error is fixed on dev, but there's something else going on that the @gif macro is hanging

narayanivedam commented 7 years ago

using Plots anim = @animate for l = 1:1:n plot(y[l,:],x[l,:]) end gif(anim, "/tmp/anim_fps15.gif", fps = 15) On trying to run this I get an error which says @animate not defined. How do I fix this?

ChrisRackauckas commented 7 years ago

@ennvvy that's a different issue. Please open another issue for that.

Nectarineimp commented 7 years ago

ImageMagick has an option to also install legacy applications and convert is one of them. It is not checked by default. I fresh installed ImageMagick and it worked, but I can see a potential for a conflict with the DOS version of convert. Cavet Emptor.

mkborregaard commented 7 years ago

Can you try Pkg.checkout("Plots") - master has passed all the functionality to ffmpeg

mkborregaard commented 7 years ago

I'm closing this as it seems outdated - please reopen if the problem recurs.