Skip to content

Animations are (mostly) broken #4967

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

Closed
WeatherGod opened this issue Aug 20, 2015 · 14 comments
Closed

Animations are (mostly) broken #4967

WeatherGod opened this issue Aug 20, 2015 · 14 comments
Milestone

Comments

@WeatherGod
Copy link
Member

Trying out chapter 3 of my book. Most of my examples are broken in master. Only two of them work out of the box: "chp3/fun_with_timers.py" and "chp3/session_recorder.py" (yes, I wrote a session recorder using the animation module...)

The rest of the examples fail with one of two kinds of tracebacks. The first one:

ben@tigger:~/Documents/InteractiveMPL$ python chp3/track_tails.py 
Traceback (most recent call last):
  File "chp3/track_tails.py", line 65, in <module>
    stormcells['frame_index'].max() + 1, fargs=(stormcells,))
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1128, in __init__
    TimedAnimation.__init__(self, fig, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 973, in __init__
    *args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 594, in __init__
    self._init_draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1156, in _init_draw
    self._draw_frame(next(self.new_frame_seq()))
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1173, in _draw_frame
    for a in self._drawn_artists:
TypeError: 'NoneType' object is not iterable

happens for most of them (I haven't figured out why yet). The second one is a maximum recursion depth limit error:

   <...snipped...>
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 474, in draw
    self.figure.draw(self.renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1140, in draw
    self.canvas.draw_event(renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 1808, in draw_event
    self.callbacks.process(s, event)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 562, in process
    proxy(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 429, in __call__
    return mtd(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 616, in _start
    self._init_draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1044, in _init_draw
    fig.canvas.draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt5agg.py", line 149, in draw
    FigureCanvasAgg.draw(self)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 474, in draw
    self.figure.draw(self.renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1140, in draw
    self.canvas.draw_event(renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 1808, in draw_event
    self.callbacks.process(s, event)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 562, in process
    proxy(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 429, in __call__
    return mtd(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 616, in _start
    self._init_draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1044, in _init_draw
    fig.canvas.draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt5agg.py", line 149, in draw
    FigureCanvasAgg.draw(self)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 474, in draw
    self.figure.draw(self.renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1140, in draw
    self.canvas.draw_event(renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 1808, in draw_event
    self.callbacks.process(s, event)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 562, in process
    proxy(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 429, in __call__
    return mtd(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 616, in _start
    self._init_draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1044, in _init_draw
    fig.canvas.draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt5agg.py", line 149, in draw
    FigureCanvasAgg.draw(self)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 474, in draw
    self.figure.draw(self.renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1140, in draw
    self.canvas.draw_event(renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 1808, in draw_event
    self.callbacks.process(s, event)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 562, in process
    proxy(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 429, in __call__
    return mtd(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 616, in _start
    self._init_draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1044, in _init_draw
    fig.canvas.draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt5agg.py", line 149, in draw
    FigureCanvasAgg.draw(self)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 474, in draw
    self.figure.draw(self.renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1140, in draw
    self.canvas.draw_event(renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 1808, in draw_event
    self.callbacks.process(s, event)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 562, in process
    proxy(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 429, in __call__
    return mtd(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 616, in _start
    self._init_draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1044, in _init_draw
    fig.canvas.draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt5agg.py", line 149, in draw
    FigureCanvasAgg.draw(self)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 474, in draw
    self.figure.draw(self.renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1140, in draw
    self.canvas.draw_event(renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 1808, in draw_event
    self.callbacks.process(s, event)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 562, in process
    proxy(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 429, in __call__
    return mtd(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 616, in _start
    self._init_draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1044, in _init_draw
    fig.canvas.draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt5agg.py", line 149, in draw
    FigureCanvasAgg.draw(self)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 474, in draw
    self.figure.draw(self.renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1134, in draw
    func(*args)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/axes/_base.py", line 2132, in draw
    self.patch.draw(renderer)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/patches.py", line 514, in draw
    transform = self.get_transform()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/patches.py", line 195, in get_transform
    return self.get_patch_transform() + artist.Artist.get_transform(self)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/patches.py", line 670, in get_patch_transform
    self._update_patch_transform()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/patches.py", line 663, in _update_patch_transform
    bbox = transforms.Bbox.from_bounds(x, y, width, height)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/transforms.py", line 834, in from_bounds
    return Bbox.from_extents(x0, y0, x0 + width, y0 + height)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/transforms.py", line 845, in from_extents
    return Bbox(points)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/transforms.py", line 787, in __init__
    BboxBase.__init__(self, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/transforms.py", line 98, in __init__
    self._parents = WeakValueDictionary()
  File "/home/ben/miniconda/lib/python2.7/weakref.py", line 59, in __init__
    UserDict.UserDict.__init__(self, *args, **kw)
RuntimeError: maximum recursion depth exceeded while calling a Python object
@tacaswell tacaswell added this to the next point release milestone Aug 20, 2015
@tacaswell
Copy link
Member

Is the code someplace we can get to?

@dopplershift
Copy link
Contributor

The infinite recursion might be fixed over in #4821.

@WeatherGod
Copy link
Member Author

I am working on coming up with a minimum example. I figure I would at least document what I got so far. Considering that this is happening in several of my examples, I doubt it is some sort of edge case.

I'll give #4821 a try.

@tacaswell
Copy link
Member

I'll take a non-minimal example of this!

I strongly suspect this is my fault.

@WeatherGod
Copy link
Member Author

#4821 fixes both the recusion issue and the first exception. However it
revealed some other concerning issues. Essentially, any animations that are
actually multiple animation objects plotted together are completely out of
sync with each other. Even in the example where I gave them all the same
event source. It looks like it is advancing one animation twice for every
one step of the others?

Saving a gif is also failing:

ben@tigger:~/Documents/InteractiveMPL$ python chp3/quick_animation.py
Traceback (most recent call last):
  File "chp3/quick_animation.py", line 289, in <module>
    anim.save('storms.gif', writer='imagemagick')
  File
"/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py",
line 1160, in save
    for a in all_anim]):
  File
"/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py",
line 1555, in new_saved_frame_seq
    self._old_saved_seq = self._save_seq.copy()
AttributeError: 'list' object has no attribute 'copy'

On Wed, Aug 19, 2015 at 10:47 PM, Thomas A Caswell <notifications@github.com

wrote:

I'll take a non-minimal example of this!

I strongly suspect this is my fault.


Reply to this email directly or view it on GitHub
#4967 (comment)
.

@tacaswell
Copy link
Member

The copy thing is apparently a 2/3 difference.

@dopplershift
Copy link
Contributor

If you can get me a stripped down example of the shared event sources being broken, I promise to look at it.

@tacaswell
Copy link
Member

@WeatherGod Can you re-test this?

@WeatherGod
Copy link
Member Author

@tacaswell, well, I don't get the copy issue anymore... Instead, I am getting variations on a theme:

ben@tigger:~/Documents/InteractiveMPL$ python chp3/quick_animation.py
Traceback (most recent call last):
  File "chp3/quick_animation.py", line 289, in <module>
    anim.save('storms.gif', writer='imagemagick')
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1158, in save
    anim._init_draw()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1567, in _init_draw
    self._draw_frame(next(self.new_frame_seq()))
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/animation.py", line 1584, in _draw_frame
    for a in self._drawn_artists:
TypeError: 'NoneType' object is not iterable

Sometimes it is NoneType, sometimes it is LineCollection... depends on which animation script I run. I am guessing that _drawn_artists is sometimes being a scalar instead of a list? Note, it doesn't have to be saving to a file, it just has to run the animation.

@WeatherGod
Copy link
Member Author

There is only one animation script that I can get working correctly. Don't know what changed between the last time I tried that PR out and now (I did rebase that PR, to get all the latest fixes), but I don't recall anything else animation related going on. Maybe it is backend-dependent because I have been switching around default backends to exercise various things? This latest round of tracebacks come courtesy of the TkAgg backend.

@WeatherGod
Copy link
Member Author

new theory...

Something broke between the maser commit that the JSAnimation branch is based off of and the master branch I tested last week. So, when I tried out the JSAnimation branch, the problem appeared "fixed".

@WeatherGod
Copy link
Member Author

Well, at the very least, #4821 fixes the maximum recursion limit issue. Something was introduced to master between then and last week that is causing the NoneType isn't iterable error.

@tacaswell
Copy link
Member

I know what broke it (because I broke it in 51cc0ca or there abouts) 😉

@tacaswell
Copy link
Member

Closing as this was fixed by #4995 @WeatherGod Re-open if you disagree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants