Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matplotlib on Python 2 bugs out when there are non-ASCII characters in user's home directory #24379

Closed
embray opened this issue Dec 15, 2017 · 12 comments

Comments

@embray
Copy link
Contributor

embray commented Dec 15, 2017

The matplotlib/__init__.py module contains from future import unicode_literals which is often inadvisable, as it can run afoul of some of Python's own unicode bugs.

In particular at one point it calls os.path.expanduser('~'), where because of unicode_literals this becomes os.path.expanduser(u'~'). This does not take care to decode the results of os.environ['HOME'] (assuming it is ASCII), and ends up concatenating a unicode string with a non-unicode string, which means trying to first decoded the non-unicode string with the default (ASCII) encoding.

This is a bug in matplotlib but it affects Sage users, particularly on Windows where non-ASCII usernames are more common (may also affect OSX users): https://ask.sagemath.org/question/40131/sagemath-80-using-windows-installer

Upstream report: matplotlib/matplotlib#10017

Depends on #25702

Upstream: Fixed upstream, in a later stable release.

CC: @slel @sagetrac-epalezzato

Component: packages: standard

Keywords: matplotlib, days94

Reviewer: Erik Bray

Issue created by migration from https://trac.sagemath.org/ticket/24379

@embray embray added this to the sage-8.2 milestone Dec 15, 2017
@kiwifb
Copy link
Member

kiwifb commented Dec 15, 2017

comment:1

It looks like it is still present in the latest release (2.1.0), for which I have been working on an upgrade at #23696.

from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

@embray

This comment has been minimized.

@embray
Copy link
Contributor Author

embray commented Dec 19, 2017

Changed upstream from Not yet reported upstream; Will do shortly. to Reported upstream. No feedback yet.

@embray embray modified the milestones: sage-8.2, sage-8.3 Apr 26, 2018
@sagetrac-epalezzato
Copy link
Mannequin

sagetrac-epalezzato mannequin commented Jun 29, 2018

Changed upstream from Reported upstream. No feedback yet. to Fixed upstream, in a later stable release.

@sagetrac-epalezzato
Copy link
Mannequin

sagetrac-epalezzato mannequin commented Jun 29, 2018

comment:4

This should be solved by upgrading to matplotlib 2.2.2 which has the upstream fix.

@sagetrac-epalezzato
Copy link
Mannequin

sagetrac-epalezzato mannequin commented Jun 29, 2018

Changed keywords from none to matplotlib, days94

@sagetrac-epalezzato
Copy link
Mannequin

sagetrac-epalezzato mannequin commented Jun 29, 2018

Dependencies: #25702

@embray embray modified the milestones: sage-8.3, sage-8.4 Jul 18, 2018
@embray embray modified the milestones: sage-8.4, sage-8.5 Oct 28, 2018
@kiwifb
Copy link
Member

kiwifb commented Oct 31, 2018

Author: François Bissey

@kiwifb
Copy link
Member

kiwifb commented Oct 31, 2018

comment:7

This is arguably fixed by #25702 (upgrade to MPL 2.2.2 with the fix).

@kiwifb kiwifb removed this from the sage-8.5 milestone Oct 31, 2018
@embray
Copy link
Contributor Author

embray commented Oct 31, 2018

comment:8

Yep; IIRC this was fixed, thanks for the triaging.

@slel
Copy link
Member

slel commented Nov 1, 2018

Changed author from François Bissey to none

@slel
Copy link
Member

slel commented Nov 1, 2018

Reviewer: Erik Bray

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants