Opened 15 years ago

Closed 15 years ago

#22486 closed defect (fixed)

py26-matplotlib with Qt4

Reported by: celil.rufat@… Owned by: skymoo (Adam Mercer)
Priority: Normal Milestone:
Component: ports Version: 1.8.1
Keywords: snowleopard Cc:
Port: py26-matplotlib

Description

I just installed py26-matplotlib with the Qt4 backend using the following command

sudo port install py26-matplotlib +qt4

However, this doesn't work. Running one of the examples provided:

$ python /opt/local/share/py26-matplotlib/examples/user_interfaces

returns the following error:

/embedding_in_qt4.py
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_qt4.py", line 168, in resizeEvent
    self.draw()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_qt4agg.py", line 130, in draw
    FigureCanvasAgg.draw(self)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py", line 314, in draw
    self.figure.draw(self.renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 46, in draw_wrapper
    draw(artist, renderer, *kl)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 773, in draw
    for a in self.axes: a.draw(renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 46, in draw_wrapper
    draw(artist, renderer, *kl)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py", line 1735, in draw
    a.draw(renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 46, in draw_wrapper
    draw(artist, renderer, *kl)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 742, in draw
    tick.draw(renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 46, in draw_wrapper
    draw(artist, renderer, *kl)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 196, in draw
    self.label1.draw(renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/text.py", line 515, in draw
    bbox, info = self._get_layout(renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/text.py", line 272, in _get_layout
    'lp', self._fontproperties, ismath=False)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py", line 158, in get_text_width_height_descent
    font = self._get_agg_font(prop)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py", line 195, in _get_agg_font
    fname = findfont(prop)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 1308, in findfont
    _rebuild()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 1292, in _rebuild
    fontManager = FontManager()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 984, in __init__
    self.ttffiles = findSystemFonts(paths) + findSystemFonts()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 341, in findSystemFonts
    for f in get_fontconfig_fonts(fontext):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 303, in get_fontconfig_fonts
    status, output = commands.getstatusoutput("fc-list file")
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/commands.py", line 56, in getstatusoutput
    text = pipe.read()
IOError: [Errno 4] Interrupted system call

Attachments (1)

eintr.patch (1.6 KB) - added by celil.rufat@… 15 years ago.
patch by Jouni K. Seppänen

Download all attachments as: .zip

Change History (21)

comment:1 Changed 15 years ago by celil.rufat@…

Sorry, there is a typo above. The command for running the test should be:

python /opt/local/share/py26-matplotlib/examples/user_interfaces/embedding_in_qt4.py

comment:2 Changed 15 years ago by skymoo (Adam Mercer)

Priority: HighNormal
Resolution: invalid
Status: newclosed

Take note of the message that is displayed after installing:

The default backend is now the non-interactive Agg backend, different
backends can be specified using the ~/.matplotlib/matplotlibrc file.
More details, regarding backends, can be found in the matplotlib FAQ:

http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend

You're not specifying which backend you want so its defaulting to Agg, if you run the example script specifying the QT4Agg backend it will work as expected:

python /opt/local/share/py26-matplotlib/examples/user_interfaces/embedding_in_qt4.py -DQT4Agg

comment:3 in reply to:  2 Changed 15 years ago by celil.rufat@…

Running the script with -DQT4Agg still produces to the same error on my computer.

comment:4 Changed 15 years ago by skymoo (Adam Mercer)

Cc: ram@… added

It works for me:

[ram@cizin ~]$ port installed py26-matplotlib
The following ports are currently installed:
  py26-matplotlib @0.99.1.1_0+qt4 (active)
[ram@cizin ~]$ python /opt/local/share/py26-matplotlib/examples/user_interfaces/embedding_in_qt4.py -DQT4Agg

Then the Qt window is displayed the plots as expected.

The above traceback implies you are using the Agg backend.

comment:5 in reply to:  4 Changed 15 years ago by celil.rufat@…

That traceback was of the original command. Here is the traceback when I add the "-DQT4Agg" flag:

altair:~ drufat$ port installed py26-matplotlib
The following ports are currently installed:
  py26-matplotlib @0.99.1.1_0+qt4 (active)
altair:~ drufat$ python /opt/local/share/py26-matplotlib/examples/user_interfaces/embedding_in_qt4.py -DQT4Agg
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_qt4.py", line 168, in resizeEvent
    self.draw()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_qt4agg.py", line 130, in draw
    FigureCanvasAgg.draw(self)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py", line 314, in draw
    self.figure.draw(self.renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 46, in draw_wrapper
    draw(artist, renderer, *kl)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 773, in draw
    for a in self.axes: a.draw(renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 46, in draw_wrapper
    draw(artist, renderer, *kl)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py", line 1735, in draw
    a.draw(renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 46, in draw_wrapper
    draw(artist, renderer, *kl)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 742, in draw
    tick.draw(renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 46, in draw_wrapper
    draw(artist, renderer, *kl)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 196, in draw
    self.label1.draw(renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/text.py", line 515, in draw
    bbox, info = self._get_layout(renderer)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/text.py", line 272, in _get_layout
    'lp', self._fontproperties, ismath=False)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py", line 158, in get_text_width_height_descent
    font = self._get_agg_font(prop)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py", line 195, in _get_agg_font
    fname = findfont(prop)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 1308, in findfont
    _rebuild()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 1292, in _rebuild
    fontManager = FontManager()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 984, in __init__
    self.ttffiles = findSystemFonts(paths) + findSystemFonts()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 341, in findSystemFonts
    for f in get_fontconfig_fonts(fontext):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 303, in get_fontconfig_fonts
    status, output = commands.getstatusoutput("fc-list file")
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/commands.py", line 56, in getstatusoutput
    text = pipe.read()
IOError: [Errno 4] Interrupted system call


comment:6 Changed 15 years ago by skymoo (Adam Mercer)

Do you have fontconfig installed?

comment:7 in reply to:  6 Changed 15 years ago by celil.rufat@…

Yes, I do:

altair:~ drufat$ port installed fontconfig
The following ports are currently installed:
  fontconfig @2.7.3_0+macosx (active)

comment:8 in reply to:  6 Changed 15 years ago by celil.rufat@…

It seems to me that with or without the -DQT4Agg flag there is no difference in the error output that I get. Do you get an error, when you run the script with the -DQT4Agg flag on your computer?

comment:9 Changed 15 years ago by skymoo (Adam Mercer)

Looking more closely the trackbacks are the same, and yes the script runs without error for me whether or not I specify the -DQT4Agg option.

I can't understand whats going on as it all works for me. I've noticed you've email the matplotlib list, hopefully they'll be able to shed some light on the matter...

comment:10 Changed 15 years ago by skymoo (Adam Mercer)

Resolution: invalid
Status: closedreopened

comment:11 Changed 15 years ago by skymoo (Adam Mercer)

Owner: changed from macports-tickets@… to ram@…
Status: reopenednew

comment:12 Changed 15 years ago by skymoo (Adam Mercer)

Cc: ram@… removed
Status: newassigned

comment:13 in reply to:  9 Changed 15 years ago by celil.rufat@…

Are you running on Snow Leopard 10.6?

altair:~ drufat$ uname -a
Darwin altair 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov  3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386

comment:14 Changed 15 years ago by skymoo (Adam Mercer)

yep:

$ uname -a
Darwin cizin.local 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov  3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386 i386

Are you using a 32 or 64bit system?

comment:15 in reply to:  14 Changed 15 years ago by celil.rufat@…

I'm compiling everything in 64bit.

I've noticed that py26-matplotlib depends on py26-pyobjc2. However, it seems that there is a problem with that port on my system as seen below. I am not sure if this is related to the current issue, or if it is an unrelated bug. Can you check if your py26-pyobjc2 is working properly?

altair:~ drufat$ port deps py26-matplotlib
Full Name: py26-matplotlib @0.99.1.1+tkinter
Library Dependencies: python26, freetype, libpng, py26-dateutil, py26-tz,
                      py26-numpy, py26-configobj, py26-pyobjc2,
                      py26-pyobjc2-cocoa
altair:~ drufat$ python
Python 2.6.4 (r264:75706, Nov 11 2009, 01:57:04) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Foundation
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Foundation/__init__.py", line 10, in <module>
    from CoreFoundation import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/CoreFoundation/__init__.py", line 17, in <module>
    scan_classes=False)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyObjC/objc/_bridgesupport.py", line 129, in initFrameworkWrapper
    _parseBridgeSupport(data, globals, frameworkName, dylib_path)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyObjC/objc/_bridgesupport.py", line 53, in _parseBridgeSupport
    objc.parseBridgeSupport(data, globals, frameworkName, *args, **kwds)
ValueError: Unknown typestr
>>> exit()

comment:16 Changed 15 years ago by skymoo (Adam Mercer)

Same here, I've opened #22489 for this.

comment:17 Changed 15 years ago by jmroot (Joshua Root)

Keywords: snowleopard added; py26-matplotlib qt4 removed
Port: py26-matplotlib added; snow leopard 10.6 removed

comment:18 Changed 15 years ago by skymoo (Adam Mercer)

Let me know if the patch suggested on the upstream list fixes the problem, if so I'll look at integrating it into the port.

Changed 15 years ago by celil.rufat@…

Attachment: eintr.patch added

patch by Jouni K. Seppänen

comment:19 in reply to:  18 Changed 15 years ago by celil.rufat@…

I can confirm the attached patch fixes the problem on my computer. Thanks for your help!

comment:20 Changed 15 years ago by skymoo (Adam Mercer)

Resolution: fixed
Status: assignedclosed

Add upstream patch in r60517

Note: See TracTickets for help on using tickets.