qutip / qutip-notebooks

A collection of IPython notebooks using QuTiP: examples, tutorials, development test, etc.
BSD 3-Clause "New" or "Revised" License
235 stars 236 forks source link

jupyter notebook example bloch-sphere-animation - matplotlib.animation:MovieWriter avconv unavailable #64

Open ghost opened 6 years ago

ghost commented 6 years ago

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. Granade

QuTiP 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)
ghost commented 6 years ago

I managed to get rid of that error by running

` brew install libav

brew install ffmpeg `

Now when the example runs I don't get any errors but the video is 15seconds of nothing but white screen

image

ghost commented 6 years ago

image

MaKaili commented 5 years ago

I solve this problem by setting blit=False in plot_animation() function in ipynbtools.py file.

alkinkaz commented 3 years ago

Replicated this issue in Ubuntu 20.04 (WSL), also matplotlib complains about how avconv will be deprecated.

Fat-Pigeon commented 2 years ago

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.