-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FuncAnimation.save throws TypeError #16965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the report @rmeno12 . We have a PR to fix the exception, but you will still have the problem that you do not have ffmpeg installed so will not be able to create an mp4 for you. |
Closed by #16965. |
I seem to be having the same problem, any idea when the fix will come out? Is there any workaround? Is there an older version without this problem? I am using ArtistAnimation with the same problem on version 3.2.1. |
3.2.2 will be out with the release candidate for 3.3.0, either end of this week or some time next week. |
Its still not around. |
We are a mostly volunteer organization and sometimes release dates slip. Any help clearing the remaining issues for 3.2.2 and 3.3.0 would be appreciated and expedite the process. https://github.com/matplotlib/matplotlib/milestone/52 |
Part of <#7>. The current strategy is to produce .gif files locally and then convert them to .webm and then serve the .webm's. There is currently a bug with matplotlib that mp4 cannot be created: <matplotlib/matplotlib#16965>. This strategy is *very* slow. As with the rest of the graphics (and also with the MercuryPostprocessing library), the massive bottleneck is reading the .data. files, which are read in their entirety even if you want only a few thousand lines. Since the process is so long and costly, there is the risk of submitting two requests, and the second one overwriting the first, and duplicating the effort. Maybe use some sort of locking. More importantly, use queueing (<#24>).
I'm using
I still only got |
@StevenLi-DS This fix is on 3.2.2 to get the better fallback behavior, but that won't solve your installation problem.
|
I am using matplotlib 3.3.2 on windows and still get the error "TypeError: 'str' object is not callable" when using animation save. Any help would be appreciated :) |
Can you open a new issue with a minimal example that causes the issue? |
I'm getting the same issue as @ndavoudi |
We can't fix an error if we can't trigger it. Can someone provide a MWE so we can try and fix? |
I think this is just related to ' fallback behavior', perhaps? When reinstalled ffmpeg the issue was resolved. So there is something up with the pillow fallback perhaps? So the MWE would be to uninstall ffmpeg and see if the fallback behavior acts as expected? Anyway the issue is resolved for me currently. |
I am getting the same "TypeError: 'MovieWriterRegistry' object is not an iterator" message, does anyone know if this bug has now been fixed and therefore whether it's a problem at my end? |
@bcalvr if it is exactly the same repro as the original issue we can re-open. If its different, then please open a new issue with the reproducible example. Also it looks like stating whether you have ffmpeg or not may be helpful. Perhaps we have a broken untested fallback? |
I think I have managed to solve the problem - it was to do with the location of my ffmpeg installation. Thank you for the response though! I am now able to export animations to video files, but I am still struggling with getting them to play inline in Atom! |
Installation of FFmpeg in anaconda(from https://blog.csdn.net/Linli522362242/article/details/121313449): fig = plt.figure() def ani_func(i): ani = animation.FuncAnimation(fig, ani_func, frames=10, repeat=False) |
since you didn't install FFmpeg in anaconda, see detail solutions:https://blog.csdn.net/Linli522362242/article/details/121313449 |
Bug report
Bug summary
I was trying to use FuncAnimation's save method to save an animation that I'd created to a .mp4 file, but it threw a TypeError when I ran my code (the animation displays fine with plt.show()).
Code for reproduction
Actual outcome
The animation itself works fine in plt.show() producing this image as the last frame as expected:

However, the animation doesn't save to
test.mp4
and instead throws a TypeError. I have included the entire traceback below.Matplotlib version
print(matplotlib.get_backend())
): TkAggMatplotlib was installed via pip in a venv.
The text was updated successfully, but these errors were encountered: