RuntimeError: No MovieWriters available!

At the very last cell in sgd-intro.ipynb, it’s intended to visualize learning process of SGD.
But when I run it as it is, the animation gets error.


ani = animation.FuncAnimation(fig, animate, np.arange(0, 40), interval=100)
ani

RuntimeError                              Traceback (most recent call last)
/home/ubuntu/anaconda2/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
    309             method = get_real_method(obj, self.print_method)
    310             if method is not None:
--> 311                 return method()
    312             return None
    313         else:

/home/ubuntu/anaconda2/lib/python2.7/site-packages/matplotlib/animation.pyc in _repr_html_(self)
   1007         fmt = rcParams['animation.html']
   1008         if fmt == 'html5':
-> 1009             return self.to_html5_video()
   1010 
   1011 

/home/ubuntu/anaconda2/lib/python2.7/site-packages/matplotlib/animation.pyc in to_html5_video(self)
    977                 # We create a writer manually so that we can get the
    978                 # appropriate size for the tag
--> 979                 Writer = writers[rcParams['animation.writer']]
    980                 writer = Writer(codec='h264',
    981                                 bitrate=rcParams['animation.bitrate'],

/home/ubuntu/anaconda2/lib/python2.7/site-packages/matplotlib/animation.pyc in __getitem__(self, name)
     87     def __getitem__(self, name):
     88         if not self.avail:
---> 89             raise RuntimeError("No MovieWriters available!")
     90         return self.avail[name]
     91 

RuntimeError: No MovieWriters available!

I found a solution here and it says that I should do:

sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install ffmpeg gstreamer0.10-ffmpeg

But the last line did not get through. Is there any other work around?

1 Like

Try the last line again with just ffmpeg.

3 Likes

BTW life is a little easier if you replace ‘apt-get’ with just ‘apt’ nowadays… :slight_smile:

5 Likes

Thank you @davecg, the command worked.

sudo apt install ffmpeg

2 Likes

i encountered the same problem, but since i’m on Mac, the solution is to use brew:
brew install ffmpeg

Ran into the same issue. Since I was running Windows + Anaconda (was executing the notebook within a conda environment) found the following solution helpful.

activate <ENV_NAME>
conda install -c menpo ffmpeg

1 Like

It works! We do only need to install ffmpeg. :grinning: