matplotlib: no output with Agg - TkAgg - Qt5Agg -- stuck at ttconv.so

Hello,

I use python/matplotlib scripts regularly to produce nice figures from raw
data files. After the summer break I did an update of my Gentoo box and I
have
now a problem with matplotlib. It produces no graphical output: no pop-up
window with a graph and no way to save a plot. I have tried to change
the backend : with TkAgg or Qt5Agg the process is stuck forever <defunct>
and to be killed manually kill -9, with Agg it is slightly better, I get
back the command line
but the pdf file created is not complete, unreadable by Okular.

here are the versions:

so it's gentoo box
kernek is 3.10.17
python 2.7.10
dev-python/matplotlib-1.5.3

I use also ipython-5.1.0 which shows the same problem.
I tried the new jupyter qtconsole which hangs when displaying a plot.

I ran a minimal script that contains the problem:

···

*************************************
from pylab import *
x=[1.,2.,3.]
y=[2.,3.,4.]
plot(x,y,'o')
savefig('myf.pdf',format='pdf')
*************************************

the same behavior arises in interactive shell, calling directly matplotlib
directly
instead of pylab.

running the script with python -v my_script.py
gives a very verbose output whose end is:

....
import matplotlib.backends.qt_editor.formsubplottool # precompiled from
/usr/lib64/python2.7/site-packages/matplotlib/backends/qt_editor/formsubplottool.pyc
# /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pdf.pyc
matches
/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pdf.py
import matplotlib.backends.backend_pdf # precompiled from
/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pdf.pyc
# /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_mixed.pyc
matches
/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_mixed.py
import matplotlib.backends.backend_mixed # precompiled from
/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_mixed.pyc
# /usr/lib64/python2.7/site-packages/matplotlib/type1font.pyc matches
/usr/lib64/python2.7/site-packages/matplotlib/type1font.py
import matplotlib.type1font # precompiled from
/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyc
dlopen("/usr/lib64/python2.7/site-packages/matplotlib/ttconv.so", 2);
import matplotlib.ttconv # dynamically loaded from
/usr/lib64/python2.7/site-packages/matplotlib/ttconv.so

it dies right at ttconv.so
the process is then <defunct>
should be killed with -9

Looking for ttconv.so seems OK ...

tjoli at skynet matplotlib % file ttconv.so
ttconv.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux),
dynamically linked, stripped

tjoli at skynet matplotlib % ldd ttconv.so
        linux-vdso.so.1 (0x00007fffe9b1f000)
        libstdc++.so.6 =>
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6 (0x00007f85f6445000)
        libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0
(0x00007f85f6076000)
        libgcc_s.so.1 =>
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libgcc_s.so.1 (0x00007f85f5e5f000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f85f5ac3000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f85f57c4000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f85f6a0c000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f85f55a8000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f85f53a4000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007f85f51a0000)
        
If I use Agg then the end of the output with '-v' is the same but I get back
the command line.
No appearance of the usual cleanup messages that appear after a successful
run.

Any ideas would be welcome
thanks in advance.
(In case it is gentoo-specific I posted this problem on the gentoo forum -
no answers yet.)

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlib-no-output-with-Agg-TkAgg-Qt5Agg-stuck-at-ttconv-so-tp47535.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

The ttconv.so stuff has to do with font handling. Since it is happening
with all backends, I suspect that the problem is with the font-cache build,
which is done at the first import of matplotlib (or when the cache needs
updating) -- regardless of the selected backend.

I would try a completely clean rebuild of matplotlib (just nuke it from
orbit), and capture the build logs in case there are some notes/warnings in
it regarding linking to freetype.

Cheers!
Ben Root

···

On Wed, Sep 21, 2016 at 5:54 AM, Thierry <thierry.jolicoeur at u-psud.fr> wrote:

Hello,

I use python/matplotlib scripts regularly to produce nice figures from raw
data files. After the summer break I did an update of my Gentoo box and I
have
now a problem with matplotlib. It produces no graphical output: no pop-up
window with a graph and no way to save a plot. I have tried to change
the backend : with TkAgg or Qt5Agg the process is stuck forever <defunct>
and to be killed manually kill -9, with Agg it is slightly better, I get
back the command line
but the pdf file created is not complete, unreadable by Okular.

here are the versions:

so it's gentoo box
kernek is 3.10.17
python 2.7.10
dev-python/matplotlib-1.5.3

I use also ipython-5.1.0 which shows the same problem.
I tried the new jupyter qtconsole which hangs when displaying a plot.

I ran a minimal script that contains the problem:

*************************************
from pylab import *
x=[1.,2.,3.]
y=[2.,3.,4.]
plot(x,y,'o')
savefig('myf.pdf',format='pdf')
*************************************

the same behavior arises in interactive shell, calling directly matplotlib
directly
instead of pylab.

running the script with python -v my_script.py
gives a very verbose output whose end is:

....
import matplotlib.backends.qt_editor.formsubplottool # precompiled from
/usr/lib64/python2.7/site-packages/matplotlib/backends/
qt_editor/formsubplottool.pyc
# /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pdf.pyc
matches
/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pdf.py
import matplotlib.backends.backend_pdf # precompiled from
/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pdf.pyc
# /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_mixed.pyc
matches
/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_mixed.py
import matplotlib.backends.backend_mixed # precompiled from
/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_mixed.pyc
# /usr/lib64/python2.7/site-packages/matplotlib/type1font.pyc matches
/usr/lib64/python2.7/site-packages/matplotlib/type1font.py
import matplotlib.type1font # precompiled from
/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyc
dlopen("/usr/lib64/python2.7/site-packages/matplotlib/ttconv.so", 2);
import matplotlib.ttconv # dynamically loaded from
/usr/lib64/python2.7/site-packages/matplotlib/ttconv.so

it dies right at ttconv.so
the process is then <defunct>
should be killed with -9

Looking for ttconv.so seems OK ...

tjoli at skynet matplotlib % file ttconv.so
ttconv.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux),
dynamically linked, stripped

tjoli at skynet matplotlib % ldd ttconv.so
        linux-vdso.so.1 (0x00007fffe9b1f000)
        libstdc++.so.6 =>
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6 (0x00007f85f6445000)
        libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0
(0x00007f85f6076000)
        libgcc_s.so.1 =>
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libgcc_s.so.1 (0x00007f85f5e5f000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f85f5ac3000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f85f57c4000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f85f6a0c000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f85f55a8000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f85f53a4000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007f85f51a0000)

If I use Agg then the end of the output with '-v' is the same but I get
back
the command line.
No appearance of the usual cleanup messages that appear after a successful
run.

Any ideas would be welcome
thanks in advance.
(In case it is gentoo-specific I posted this problem on the gentoo forum -
no answers yet.)

--
View this message in context: http://matplotlib.1069221.n5.
nabble.com/matplotlib-no-output-with-Agg-TkAgg-Qt5Agg-
stuck-at-ttconv-so-tp47535.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160922/104284fd/attachment.html&gt;

after a complete rebuild the situation is basically unchanged...
there is no complaint about freetype in the build log

and the typical outcome
here the default backend is Qt5Agg - this is the first wake-up of newborn
matplotlib:

tjoli at skynet ~ % python
Python 2.7.10 (default, Nov 19 2015, 13:26:08)
[GCC 4.9.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from pylab import *

/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:273:
UserWarning: Matplotlib is building the font cache using fc-list. This may
take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This
may take a moment.')

x=[1.,2.,3.]
y=[2.,3.,4.]
plot(x,y,'o')

[<matplotlib.lines.Line2D object at 0x7fb7f0aff5d0>]

show()

Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlib-no-output-with-Agg-TkAgg-Qt5Agg-stuck-at-ttconv-so-tp47535p47541.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

I ran a small script to check fonts:

from matplotlib.font_manager import FontProperties, findfont
fp = FontProperties(family='monospace',
                        style='normal',
                        variant='normal',
                        weight='normal',
                        stretch='normal',
                        size='medium')
                      
font = findfont(fp)

doing python my_script.py --verbose-debug leads to:

tjoli at skynet Desktop % python fonts.py --verbose-debug
$HOME=/home/tjoli
matplotlib data path /usr/lib64/python2.7/site-packages/matplotlib/mpl-data

···

*****************************************************************
You have the following UNSUPPORTED LaTeX preamble customizations:

Please do not ask for support with these customizations active.
*****************************************************************

loaded rc file
/usr/lib64/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.5.3
verbose.level debug
interactive is False
platform is linux2
loaded modules: <dictionary-keyiterator object at 0x7fe41e9879f0>
CACHEDIR=/home/tjoli/.cache/matplotlib
Using fontManager instance from /home/tjoli/.cache/matplotlib/fontList.cache
findfont: Matching
:family=monospace:style=normal:variant=normal:weight=400:stretch=normal:size=medium
to Bitstream Vera Sans Mono
(u'/usr/lib64/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/VeraMono.ttf')
with score of 0.000000
tjoli at skynet Desktop % ls
/usr/lib64/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf
COPYRIGHT.TXT STIXNonUni.ttf STIXSizOneSymReg.ttf
VeraIt.ttf cmex10.ttf
LICENSE_STIX STIXNonUniBol.ttf STIXSizThreeSymBol.ttf
VeraMoBI.ttf cmmi10.ttf
README.TXT STIXNonUniBolIta.ttf STIXSizThreeSymReg.ttf
VeraMoBd.ttf cmr10.ttf
RELEASENOTES.TXT STIXNonUniIta.ttf STIXSizTwoSymBol.ttf
VeraMoIt.ttf cmss10.ttf
STIXGeneral.ttf STIXSizFiveSymReg.ttf STIXSizTwoSymReg.ttf
VeraMono.ttf cmsy10.ttf
STIXGeneralBol.ttf STIXSizFourSymBol.ttf Vera.ttf
VeraSe.ttf cmtt10.ttf
STIXGeneralBolIta.ttf STIXSizFourSymReg.ttf VeraBI.ttf
VeraSeBd.ttf
STIXGeneralItalic.ttf STIXSizOneSymBol.ttf VeraBd.ttf
cmb10.ttf
tjoli at skynet Desktop %

so the fallback VeraSans are taken into account

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlib-no-output-with-Agg-TkAgg-Qt5Agg-stuck-at-ttconv-so-tp47535p47542.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

The error for Qt5 is a bug that has very recently been fixed. I am pretty
sure it is in v1.5.3. (Well... not exactly fixed, more that it won't crash
the interpreter). It does seem like you are making it further than you were
before. It would be good to see the traceback from the Qt5 failure, and to
know which version of matplotlib you are using.

···

On Fri, Sep 23, 2016 at 6:06 AM, Thierry <thierry.jolicoeur at u-psud.fr> wrote:

I ran a small script to check fonts:

from matplotlib.font_manager import FontProperties, findfont
fp = FontProperties(family='monospace',
                        style='normal',
                        variant='normal',
                        weight='normal',
                        stretch='normal',
                        size='medium')

font = findfont(fp)

doing python my_script.py --verbose-debug leads to:

tjoli at skynet Desktop % python fonts.py --verbose-debug
$HOME=/home/tjoli
matplotlib data path /usr/lib64/python2.7/site-
packages/matplotlib/mpl-data

*****************************************************************
You have the following UNSUPPORTED LaTeX preamble customizations:

Please do not ask for support with these customizations active.
*****************************************************************

loaded rc file
/usr/lib64/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.5.3
verbose.level debug
interactive is False
platform is linux2
loaded modules: <dictionary-keyiterator object at 0x7fe41e9879f0>
CACHEDIR=/home/tjoli/.cache/matplotlib
Using fontManager instance from /home/tjoli/.cache/matplotlib/
fontList.cache
findfont: Matching
:family=monospace:style=normal:variant=normal:weight=
400:stretch=normal:size=medium
to Bitstream Vera Sans Mono
(u'/usr/lib64/python2.7/site-packages/matplotlib/mpl-data/
fonts/ttf/VeraMono.ttf')
with score of 0.000000
tjoli at skynet Desktop % ls
/usr/lib64/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf
COPYRIGHT.TXT STIXNonUni.ttf STIXSizOneSymReg.ttf
VeraIt.ttf cmex10.ttf
LICENSE_STIX STIXNonUniBol.ttf STIXSizThreeSymBol.ttf
VeraMoBI.ttf cmmi10.ttf
README.TXT STIXNonUniBolIta.ttf STIXSizThreeSymReg.ttf
VeraMoBd.ttf cmr10.ttf
RELEASENOTES.TXT STIXNonUniIta.ttf STIXSizTwoSymBol.ttf
VeraMoIt.ttf cmss10.ttf
STIXGeneral.ttf STIXSizFiveSymReg.ttf STIXSizTwoSymReg.ttf
VeraMono.ttf cmsy10.ttf
STIXGeneralBol.ttf STIXSizFourSymBol.ttf Vera.ttf
VeraSe.ttf cmtt10.ttf
STIXGeneralBolIta.ttf STIXSizFourSymReg.ttf VeraBI.ttf
VeraSeBd.ttf
STIXGeneralItalic.ttf STIXSizOneSymBol.ttf VeraBd.ttf
cmb10.ttf
tjoli at skynet Desktop %

so the fallback VeraSans are taken into account

--
View this message in context: http://matplotlib.1069221.n5.
nabble.com/matplotlib-no-output-with-Agg-TkAgg-Qt5Agg-stuck-at-ttconv-so-
tp47535p47542.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160923/5b43e724/attachment.html&gt;

This is matplotlib 1.5.3 / python 2.7.10

if I use the Tk backend then the plot window appear but nothing in it and
the process is stuck.
So not sure it has to do with Qt5
I don't see how to get a traceback for such graphical troubles.

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlib-no-output-with-Agg-TkAgg-Qt5Agg-stuck-at-ttconv-so-tp47535p47544.html
Sent from the matplotlib - users mailing list archive at Nabble.com.