Repository navigation
Closed
Milestone
Description
Bug report
Bug summary
In interactive python3 'from matplotlib import animation' causes an error.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 87: ordinal not in range(128)
Code for reproduction
from matplotlib import animationActual outcome
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py", line 737, in <module>
class ImageMagickWriter(ImageMagickBase, MovieWriter):
File "/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py", line 120, in wrapper
if writerClass.isAvailable():
File "/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py", line 730, in isAvailable
return super().isAvailable()
File "/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py", line 427, in isAvailable
return shutil.which(cls.bin_path()) is not None
File "/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py", line 724, in bin_path
binpath = mpl._get_executable_info('magick').executable
File "/usr/local/lib/python3.6/dist-packages/matplotlib/__init__.py", line 384, in _get_executable_info
return impl([path, "--version"], r"^Version: ImageMagick (\S*)")
File "/usr/local/lib/python3.6/dist-packages/matplotlib/__init__.py", line 324, in impl
args, stderr=subprocess.STDOUT, universal_newlines=True)
File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
**kwargs).stdout
File "/usr/lib/python3.6/subprocess.py", line 425, in run
stdout, stderr = process.communicate(input, timeout=timeout)
File "/usr/lib/python3.6/subprocess.py", line 850, in communicate
stdout = self.stdout.read()
File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 87: ordinal not in range(128)
Expected outcome
matplotlib.animation would be imported.
I am not sure it ever worked.
Matplotlib version
- Operating system: Ubuntu 18.04
- Matplotlib version: 3.1.1
- Matplotlib backend (
print(matplotlib.get_backend())): GTK3Agg - Python version: 3.6.8
- Jupyter version (if applicable):
- Other libraries:
Python3 came with the distribution and was updated with apt
matplotlib was installed with python3 -m pip install matplotlib. Updated with pip.
Metadata
Metadata
Assignees
Labels
No labels
Activity
ImportanceOfBeingErnest commentedon Jul 27, 2019
Might be related #3837
Possibly you will get more information with
jklymak commentedon Jul 27, 2019
Not sure this error makes any sense regardless, but do you have imagemagick installed?
tomdean1939 commentedon Jul 27, 2019
This error stops animation from being import'd.
And, it is related to imagemagick. Looking at python3.6/encodings/ascii.py, the 'input' that causes the error contains: b'Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114...
My log does not show imagemagick being installed. Must have either come with the system or some other package required it.
How does imagemagick get involved?
jklymak commentedon Jul 27, 2019
In order to run an animation we call outside packages. You need imagemagick if you use the imagemagick movie writer
OTOH this error probably shouldn’t happen. Ping @antzer who I think did some work on this recently
ImportanceOfBeingErnest commentedon Jul 27, 2019
Here is a pretty similar issue, https://stackoverflow.com/questions/57115893, though with a different error.
Clearly, the problem is that
matplotlib/lib/matplotlib/animation.py
Line 728 in 8d3e817
only checks for some "executable not found", but not for other errors that could happen along the way.
ImportanceOfBeingErnest commentedon Jul 27, 2019
Probably #13303 is now causing this to come up. Ping @anntzer (the one with double-N ;-))
tomdean1939 commentedon Jul 27, 2019
ImportanceOfBeingErnest commentedon Jul 27, 2019
This makes this issue two-fold:
tomdean1939 commentedon Jul 27, 2019
anntzer commentedon Jul 27, 2019
I guess something like
would work?
tomdean1939 commentedon Jul 27, 2019