jupyter notebook example bloch-sphere-animation - matplotlib.animation:MovieWriter avconv unavailable
Opened this issue · 5 comments
OS: MacOS High sierra
Python: Python 3.6.5 :: Anaconda, Inc.
I installed qutip using conda
When I run python and the following
from qutip import *
about()
I get
QuTiP: Quantum Toolbox in Python
Copyright (c) 2011 and later.
A. J. Pitchford, P. D. Nation, R. J. Johansson, A. Grimsmo, and C. GranadeQuTiP Version: 4.3.1
Numpy Version: 1.14.3
Scipy Version: 1.1.0
Cython Version: 0.28.2
Matplotlib Version: 2.2.2
Python Version: 3.6.5
Number of CPUs: 4
BLAS Info: INTEL MKL
OPENMP Installed: False
INTEL MKL Ext: True
Platform Info: Darwin (x86_64)
Installation path: /Users/xxx/anaconda3/lib/python3.6/site-packages/qutip
Then I launch the jupyter notebook and run 'bloch-sphere-animation.ipynb'
plot_animation(plot_setup, plot_result, result)
I get this
WARNING:matplotlib.animation:MovieWriter avconv unavailable.
KeyError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/PIL/Image.py in save(self, fp, format, **params)
1914 try:
-> 1915 format = EXTENSION[ext]
1916 except KeyError:KeyError: '.mp4'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
in ()
----> 1 plot_animation(plot_setup, plot_result, result)
I solve this problem by setting blit=False in plot_animation() function in ipynbtools.py file.
Replicated this issue in Ubuntu 20.04 (WSL), also matplotlib complains about how avconv will be deprecated.
I also encountered the same problem when using an example from qutip-notebooks. I think the reason for this problem is that libav, which contains anconv, has been replaced by ffmpeg. Even after libav is installed, the problem cannot be solved. So I suggest installing ffmpeg through Anaconda:
conda install -c conda-forge ffmpeg
and then change the parameter of plot_animation() function in ipynbtools.py file:
writer="anconv" -> writer="ffmpeg"
Then I solved this problem.
By the way, the reason you got nothing but white screen maybe you activated %matplotlib inline unintentionally, it's on the first line of the qutip-notebook, which also bothered me for a long time. You can change it to
%matplotlib notebook
or
%matplotlib tk
.