Bug 1047559 - fails to install stix fonts
Summary: fails to install stix fonts
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-matplotlib
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jef Spaleta
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1050923 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-31 18:32 UTC by Neal Becker
Modified: 2014-02-07 03:09 UTC (History)
7 users (show)

Fixed In Version: python-matplotlib-1.3.1-2.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-02-07 03:09:28 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
stix font errors (2.97 KB, text/plain)
2014-01-07 15:23 UTC, Roderick Johnstone
no flags Details
matplotlib.patch (16.51 KB, patch)
2014-01-28 02:18 UTC, Paulo Andrade
no flags Details | Diff

Description Neal Becker 2013-12-31 18:32:35 UTC
Description of problem:
As discussed here:
http://permalink.gmane.org/gmane.comp.python.matplotlib.devel/12650

It appears that python-matplotlib needs to install the .ttf fonts that are
shipped with matplotlib in order for stix math to work

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Paulo Andrade 2014-01-02 17:02:51 UTC
I do not recall all details, but there was some discussion at
https://bugzilla.redhat.com/show_bug.cgi?id=885307

I remember upstream stix fonts changed file names, and not all
projects adapted. Also, unless under very special circumstances,
bundling is not allowed, so, the python-matplotlib package should
not install its copy of the fonts.

If you have some simple test case demonstrating the problem, some
work could be done, e.g. I got it in a state that appears to
satisfy all sagemath doctests...

Comment 2 Roderick Johnstone 2014-01-07 15:21:55 UTC
The following example generates some stix (and other) font errors.

$ python
import pylab as p

ax=p.subplot(111)

xs=range(0,10)
ys=range(0,10)

ax.set_xscale('log')
ax.set_yscale('log')

p.plot(xs,ys)
p.show()


I will attach a file wiith the errors generated.

These are the stix packages installed.

$ rpm -qa | grep stix
stix-math-fonts-1.1.0-5.fc20.noarch
stix-fonts-1.1.0-5.fc20.noarch
texlive-stix-svn29803.1.0-4.fc20.noarch

Comment 3 Roderick Johnstone 2014-01-07 15:23:37 UTC
Created attachment 846735 [details]
stix font errors

Comment 4 Neal Becker 2014-01-07 20:30:11 UTC
You didn't do anything except a basic plot here.

The usual way I get stix font errors is use texmath.

Something like:

In matplotlibrc:
mathtext.fontset: stix

Then:

plt.title ('$\alpha=2$')

You should be able to get the same result as setting matplotlibrc by using
programatic interface.

Comment 5 Paulo Andrade 2014-01-08 18:00:50 UTC
Actually, my patch to use fontconfig was dropped
when updating from 1.2 to 1.3.

You should not have any warnings if patching like this

$ sudo vi /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py

I did not notice this problem earlier and for quite some
time I agree (very busy with other stuff)...

    - drop fontconfig patch (upstream)

Thomas? :-)

Comment 6 Paulo Andrade 2014-01-08 18:01:44 UTC
> $ sudo vi /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py

I meant

$ sudo sed -i 's/\(USE_FONTCONFIG = \)False/\1True/' /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py

Comment 7 Roderick Johnstone 2014-01-08 18:37:52 UTC
I can confirm that that fix works well for me.

Can we get this fix in a package update for F20 please?

Comment 8 Paulo Andrade 2014-01-11 15:49:58 UTC
*** Bug 1050923 has been marked as a duplicate of this bug. ***

Comment 9 Paulo Andrade 2014-01-11 16:06:30 UTC
I created a bundling exception request for stix-fonts at
https://fedorahosted.org/fpc/ticket/381

Comment 10 Roderick Johnstone 2014-01-11 22:11:46 UTC
Can you explain why a bundling exception is required please, since the work around in comment 6 seems to work fine.

Isn't it just this change to the package thats needed?

Comment 11 Paulo Andrade 2014-01-12 14:00:19 UTC
The patch originally was basically only to set
USE_FONTCONFIG = True
but that caused several side effects, that required a not
so trivial patch, but trial&error is bad... And the patch
was dropped "accidentally" because the non trivial part was
added upstream and it took quite some time to notice that
(required a fedora release and bug reports).

Upstream also says it most likely will find several other
problems in special cases.

Upstream and AFAIK (almost) all other distros bundle the
fonts (some probably by accident), so, upstream basically
only tests with bundled fonts.

Comment 12 Thomas Spura 2014-01-25 16:12:51 UTC
For now I set USE_FONTCONFIG to True in rawhide and wait until your bundling exception is completely done.

With my recent commit to git, the proper backend is now used again and we have the most recent version in rawhide.

I'll leave the font bundling issue up to you.

Comment 13 Paulo Andrade 2014-01-28 02:18:56 UTC
Created attachment 856342 [details]
matplotlib.patch

Source rpm: http://pcpa.fedorapeople.org/python-matplotlib-1.3.1-2.fc21.src.rpm

I plan to commit this patch.
It adds some Debian patches, as it is basically what I was
thinking about when asked for a bundling exception, but now
using theirs (Debian) tested approach. Changes are basically:

o Previous %{python_sitearch}/matplotlib/mpl-data was
  duplicated for python2 and python3, now it was made
  noarch and shared.
o matplotlibrc was moved from .../mpl-data to /etc, and
  again shared by both python (this one may have issues
  if one wants to install 32 and 64 bit packages, what
  I believe is not a big issue, would file conflicts but
  file with same contents).
o Fixed and enabled %check

Only problem I see is that one will need to "rm -fr ~/.matplotlib"
or will get back the errors about fonts not found. Not sure if
should add some README or write something in %post to stdout.
Other issues could be python-matplotlib-data-fonts contents,
so, here are the contents:

$ rpm -ql python-matplotlib-data-fonts
/usr/share/matplotlib/mpl-data/fonts
/usr/share/matplotlib/mpl-data/fonts/afm
/usr/share/matplotlib/mpl-data/fonts/afm/cmex10.afm
/usr/share/matplotlib/mpl-data/fonts/afm/cmmi10.afm
/usr/share/matplotlib/mpl-data/fonts/afm/cmr10.afm
/usr/share/matplotlib/mpl-data/fonts/afm/cmsy10.afm
/usr/share/matplotlib/mpl-data/fonts/afm/cmtt10.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pagd8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pagdo8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pagk8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pagko8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pbkd8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pbkdi8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pbkl8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pbkli8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pcrb8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pcrbo8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pcrr8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pcrro8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/phvb8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/phvb8an.afm
/usr/share/matplotlib/mpl-data/fonts/afm/phvbo8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/phvbo8an.afm
/usr/share/matplotlib/mpl-data/fonts/afm/phvl8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/phvlo8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/phvr8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/phvr8an.afm
/usr/share/matplotlib/mpl-data/fonts/afm/phvro8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/phvro8an.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pncb8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pncbi8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pncr8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pncri8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pplb8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pplbi8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pplr8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pplri8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/psyr.afm
/usr/share/matplotlib/mpl-data/fonts/afm/ptmb8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/ptmbi8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/ptmr8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/ptmri8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/putb8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/putbi8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/putr8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/putri8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pzcmi8a.afm
/usr/share/matplotlib/mpl-data/fonts/afm/pzdr.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-Bold.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-BoldOblique.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-Oblique.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Courier.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-Bold.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-BoldOblique.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-Oblique.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Symbol.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Bold.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Times-BoldItalic.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Italic.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Roman.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/ZapfDingbats.afm
/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/readme.txt
/usr/share/matplotlib/mpl-data/fonts/ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/COPYRIGHT.TXT
/usr/share/matplotlib/mpl-data/fonts/ttf/LICENSE_STIX
/usr/share/matplotlib/mpl-data/fonts/ttf/README.TXT
/usr/share/matplotlib/mpl-data/fonts/ttf/RELEASENOTES.TXT
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/Vera.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/VeraBI.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/VeraBd.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/VeraIt.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/VeraMoBI.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/VeraMoBd.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/VeraMoIt.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/VeraMono.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/VeraSe.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/VeraSeBd.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/cmb10.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/cmex10.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/cmr10.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/cmss10.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf
/usr/share/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf

If you have any comments, please let me know, otherwise
I will "git push" and submit builds shortly.

Comment 14 Thomas Spura 2014-01-28 08:20:51 UTC
(In reply to Paulo Andrade from comment #13)
> I plan to commit this patch.
> It adds some Debian patches, as it is basically what I was
> thinking about when asked for a bundling exception, but now
> using theirs (Debian) tested approach. Changes are basically:
> 
> o Previous %{python_sitearch}/matplotlib/mpl-data was
>   duplicated for python2 and python3, now it was made
>   noarch and shared.
> o matplotlibrc was moved from .../mpl-data to /etc, and
>   again shared by both python (this one may have issues
>   if one wants to install 32 and 64 bit packages, what
>   I believe is not a big issue, would file conflicts but
>   file with same contents).
> o Fixed and enabled %check

Thanks!

> Only problem I see is that one will need to "rm -fr ~/.matplotlib"
> or will get back the errors about fonts not found. Not sure if
> should add some README or write something in %post to stdout.

Why can this happen? It just worked over here without deleting my old config (but maybe I have too less in it...).


> If you have any comments, please let me know, otherwise
> I will "git push" and submit builds shortly.

- It would be good to also require %{name}-data with a version, as data can change between versions. Currently both python*-matplotlib only require %{name}-data without a version.
- Which default backend should we use? I'd vote for GTKAgg, as GTK should be spread among most users of us already. If someone wants to use the qt4agg, one can install manually the -qt4 package and all the qt dependencies.
See also #1030396.
- How about testing the same backend in %check as using then by default?
  Shouldn't that happen anyway, as you set MATPLOTLIBDATA?

Comment 15 Paulo Andrade 2014-01-28 15:35:17 UTC
(In reply to Thomas Spura from comment #14)
> (In reply to Paulo Andrade from comment #13)
> > I plan to commit this patch.
> > It adds some Debian patches, as it is basically what I was
> > thinking about when asked for a bundling exception, but now
> > using theirs (Debian) tested approach. Changes are basically:
> > 
> > o Previous %{python_sitearch}/matplotlib/mpl-data was
> >   duplicated for python2 and python3, now it was made
> >   noarch and shared.
> > o matplotlibrc was moved from .../mpl-data to /etc, and
> >   again shared by both python (this one may have issues
> >   if one wants to install 32 and 64 bit packages, what
> >   I believe is not a big issue, would file conflicts but
> >   file with same contents).

  The conflict cannot happen, I changed the package to noarch
to avoid these problems, as the data is really noarch, but
confused myself...

> > o Fixed and enabled %check
> 
> Thanks!
> 
> > Only problem I see is that one will need to "rm -fr ~/.matplotlib"
> > or will get back the errors about fonts not found. Not sure if
> > should add some README or write something in %post to stdout.
> 
> Why can this happen? It just worked over here without deleting my old config
> (but maybe I have too less in it...).

  I will add an workaround for it. The cache is regenerated if
TRAVIS is in os.environ, or if fontManager.__version__ (reloaded
from picked cache) is different. Since I had already regenerated
my cache with your build using fontconfig, it did not regenerate
the cache, so I am planning something like
s/__version__ = 101/__version__ = 101.1/ in font_manager.py

> > If you have any comments, please let me know, otherwise
> > I will "git push" and submit builds shortly.
> 
> - It would be good to also require %{name}-data with a version, as data can
> change between versions. Currently both python*-matplotlib only require
> %{name}-data without a version.

  I will fix it, after uploading the patch and sample srpm, also
corrected the fact that python-matplotlib-data was was not
requring python-matplotlib-data-fonts (my mistake on the first
try of the new approach).

> - Which default backend should we use? I'd vote for GTKAgg, as GTK should be
> spread among most users of us already. If someone wants to use the qt4agg,
> one can install manually the -qt4 package and all the qt dependencies.
> See also #1030396.
> - How about testing the same backend in %check as using then by default?
>   Shouldn't that happen anyway, as you set MATPLOTLIBDATA?

Ok, I think the easiest approach, in case it is changed again,
is to copy setup.cfg to matplotlibrc used during %%check

Comment 16 Fedora Update System 2014-01-28 22:15:46 UTC
python-matplotlib-1.3.1-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/python-matplotlib-1.3.1-2.fc20

Comment 17 Fedora Update System 2014-01-30 03:41:07 UTC
Package python-matplotlib-1.3.1-2.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-matplotlib-1.3.1-2.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-1804/python-matplotlib-1.3.1-2.fc20
then log in and leave karma (feedback).

Comment 18 Marco Driusso 2014-01-30 09:01:15 UTC
The update package did the job for python-matplotlib, but python3-matplotlib still complains.

Comment 19 Fedora Update System 2014-02-07 03:09:28 UTC
python-matplotlib-1.3.1-2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.