I'm trying to run an animation using matplotlib FuncAnimation and I keep running into the error "Requested MovieWriter (ffmpeg) not available". I realize this question has been asked before, and I have looked at every response to this and none have worked.
I'm running a jupyter notebook on Windows 10
I've got the following code.
from matplotlib.animation import FuncAnimation
def init():
ax.clear()
nice_axes(ax)
ax.set_ylim(.2, 6.8)
def update(i):
for bar in ax.containers:
bar.remove()
y = df_rank_expanded.iloc[i]
width = df_expanded.iloc[i]
ax.barh(y=y, width=width, color=colors, tick_label=labels)
date_str = df_expanded.index[i].strftime('%B %-d, %Y')
ax.set_title(f'Racial Unemployment - {date_str}', fontsize='smaller')
fig = plt.Figure(figsize=(4, 2.5), dpi=144)
ax = fig.add_subplot()
anim = FuncAnimation(fig=fig, func=update, init_func=init, frames=len(df_expanded),
interval=100, repeat=False)
When I run
from IPython.display import HTML
HTML(anim.to_html5_video())
I get the error RuntimeError: Requested MovieWriter (ffmpeg) not available
Here is what I've tried. 1) installing ffmpeg on my system, and setting the path value. I followed the instructions here https://www.wikihow.com/Install-FFmpeg-on-Windows I verified FFmpeg was installed by typing ffmpeg -version in the cmd window 2) conda install -c conda-forge ffmpeg
This still results in the ffmpeg not available error.
3)I've followed instructions here Matplotlib-Animation "No MovieWriters Available" which just say to do 1 and 2 above 4) Here Stop Matplotlib Jupyter notebooks from showing plot with animation which suggests using
HTML(anim.to_jshtml())
However, this gives me an invalid format string error for date_str = df_expanded.index[i].strftime('%B %-d, %Y')
5) I've set the path variable directly in the jupyter notebook
plt.rcParams['animation.ffmpeg_path'] = 'C:\FFmpeg\ffmpeg-20200610-9dfb19b-win64-static\bin\ffmpeg.exe'
6) Restarting my kernel 7) Rebooting my system 8) Breaking my computer into small pieces, grinding those through an industrial shredder, burning the pieces, salting the earth where they lay, and then getting an entirely new computer and trying everything all over.
So far, nothing has worked. When I run sample code at http://louistiao.me/posts/notebooks/embedding-matplotlib-animations-in-jupyter-as-interactive-javascript-widgets/ I can get it to work, using their code only.
But I cannot get my own code to work. Any help would be much appreciated. Thanks!