Mac backend problems for nearly all backends.

From: Christopher Barker <Chris.Barker@...259...>
Subject: Re: [Matplotlib-users] Mac backend problems for nearly all
    backends.
To: matplotlib-users@lists.sourceforge.net
Message-ID: <4BFC626C.40707@...259...>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Jonathan Stickel wrote:
> > I've experienced many of the same problems on Mac OS X 10.6.3 (Snow > > Leopard). I have python/scipy/numpy/matplotlib/ipython all installed > > via Macports.

Just to be clear -- this sounds like a MacPorts problem, not necessarily an OS-X problem.

> > I finally have the WXagg backend > > working, but that required installed WXPython with the gtk/X11 backend.

Does MacPorts not allow a native wx? Maybe becasue you're running 64 bit?

Right, I am running Snow Leopard and have Python 2.6 installed 64 bit. Apparently, Carbon requires 32 bit and wxWidgets/wxPython does not (yet) support Cocoa. This problem will bite you in one form or another on Mac OS X, regardless of whether you are using Macports or something else.

Anyway, I guess that's why I don't use macports for python.

See above.

>> >> In any case, I have been having royal problems with GUI backends and
>> >> matplotlib.
>> >> Some background on where I've been having these problems:
>> >> Machine 1: OSX 10.5.8 G5 PPC

That's what I've been running, and I've had no real issues (Haven't tried the OS-X back-end) -- but I'm using the python.org python.

>> >> Machine 2: OSX 10.5.7 Macbook pro/Intel
>> >> Code versions: python 2.5.4, Numpy 1.3.0, Scipy 0.7.0 (all obtained through
>> >> fink.)

OK -- then a fink issue, rather than a Macports one -- same idea, though.

My impression is that neither fink nor macports do well with Mac GUI stuff -- unless you're talking X11.

Not exactly true. Fink and Macports are tools and have their shortcomings, but both can be immensely useful for installing all this stuff. Otherwise, you do it manually, which of course can cause you trouble as well. Anyway, getting off topic. I only intended to report some form of success with the wx backend.

Jonathan

···

On 05/25/2010 matplotlib-users-request@lists.sourceforge.net wrote:

Thanks for the info…

1)The problem does manifest in the same manner through the normal python prompt.

  1. I’m not sure what is meant by a “framework install.” Everything (except MPL 99.1.1) was installed through fink.

  2. I’ve never had problems with Fink software before, and I have a crapload (technical term) of stuff installed. This is neither here nor there, however, as it seems that not all Pythons are created equal.

  3. A colleague of mine claims to have everything working on a new Intel mac (I’m guessing 10.5.8) right out of MacPorts; I’ll talk to him more and try to find out what is different between our two cases.

  4. I have yet to try installing wxPython for python 2.5; this may work in the end. It’s not in fink, so I’ve put off installing it manually. I’ll give it a shot and let you know how it works.

  5. Although I use x11 and not the native Mac terminal, I’m not sure if this requires me to install different packages for the gui stuff. Could you guys expand on this, please?

Finally, I’ve had some measure of success by installing Qt4 (through Fink) and using the Qt4Agg backend. Because the current stable fink Qt4 release (4.6.1) has a bug, I need to apply the fix found here:

http://old.nabble.com/Qt4-backend:-critical-bug-with-PyQt4-v4.6%2B-td26205716.html

in order to allow more than one plot per session to be shown. I’ll re-write the fix here for convenience and clarity (the original did not have the proper module references in it, so this saves some 5 minutes of tab-completion work in ipython…)

Add this before “FigureManagerQT” class

class FigureWindow(QtGui.QMainWindow):
def init(self):
super(FigureWindow, self).init()
def closeEvent(self, event):
super(FigureWindow, self).closeEvent(event)
if QtCore.PYQT_VERSION_STR.startswith(‘4.6’):

        self.emit(QtCore.SIGNAL('destroyed()')) 

Replace “QtGui.QMainWindow” by “FigureWindow” in “FigureManagerQT”'s constructor

This works perfectly on my Intel machine running MPL 99.1.1. It’s fast and looks sharp. I’ll report back on the PPC/99.0 combo tomorrow; Qt4 takes a thousand hours to compile.

Thanks for the input.

···

On Tue, May 25, 2010 at 8:48 PM, Jonathan Stickel <jjstickel@…3078…> wrote:

On 05/25/2010 matplotlib-users-request@lists.sourceforge.net wrote:

From: Christopher Barker <Chris.Barker@…259…>

Subject: Re: [Matplotlib-users] Mac backend problems for nearly all
backends.

To: matplotlib-users@lists.sourceforge.net

Message-ID: <4BFC626C.40707@…259…>

Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Jonathan Stickel wrote:

I’ve experienced many of the same problems on Mac OS X 10.6.3

(Snow

Leopard). I have python/scipy/numpy/matplotlib/ipython all

installed

via Macports.

Just to be clear – this sounds like a MacPorts problem, not

necessarily

an OS-X problem.

I finally have the WXagg backend

working, but that required installed WXPython with the gtk/X11

backend.

Does MacPorts not allow a native wx? Maybe becasue you’re running 64

bit?

Right, I am running Snow Leopard and have Python 2.6 installed 64 bit.

Apparently, Carbon requires 32 bit and wxWidgets/wxPython does not (yet)

support Cocoa. This problem will bite you in one form or another on Mac

OS X, regardless of whether you are using Macports or something else.

Anyway, I guess that’s why I don’t use macports for python.

See above.

In any case, I have been having royal problems with GUI

backends and

matplotlib.

Some background on where I’ve been having these problems:

Machine 1: OSX 10.5.8 G5 PPC

That’s what I’ve been running, and I’ve had no real issues (Haven’t

tried the OS-X back-end) – but I’m using the python.org python.

Machine 2: OSX 10.5.7 Macbook pro/Intel

Code versions: python 2.5.4, Numpy 1.3.0, Scipy 0.7.0 (all

obtained through

fink.)

OK – then a fink issue, rather than a Macports one – same idea,

though.

My impression is that neither fink nor macports do well with Mac GUI

stuff – unless you’re talking X11.

Not exactly true. Fink and Macports are tools and have their

shortcomings, but both can be immensely useful for installing all this

stuff. Otherwise, you do it manually, which of course can cause you

trouble as well. Anyway, getting off topic. I only intended to report

some form of success with the wx backend.

Jonathan



Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

1)The problem does manifest in the same manner through the normal python
prompt.

OK that is good to know.

  1. I’m not sure what is meant by a “framework install.” Everything (except MPL 99.1.1)
    was installed through fink.

This is important. Check where python is installed. If ‘which python’ shows /Library/Frameworks/Python.framework/Versions/2.6/bin/python or something similar, you have a framework version. If on the other hand it shows /usr/bin/python, /usr/local/bin/python, or something similar, you don’t have a framework version. I don’t know what fink installs by default. If you don’t have Python installed as a framework, some backends (including the MacOSX backend) will not interact properly with the window manager. This is a Mac peculiarity. If you build Python from source, you can specify to install a framework version by passing the --enable-framework option to the configure script.

  1. Although I use x11 and not the native Mac terminal, I’m not sure if this requires me to > install different packages for the gui stuff. Could you guys expand on this, please?

Some backends go make use of X11 (e.g., the gtkcairo backend), others do not (e.g., the MacOSX backend). The MacOSX backend should work with both the native Mac terminal and with an X11 terminal.

–Michiel.

  1. In which case, it’s not a framework install. Fink puts everything into /sw/; there’s nothing to do with pyton in /Library/Frameworks.

Thanks for the clarification; I’m tempted to get Python from source and try this…

-dw

···

On Tue, May 25, 2010 at 10:41 PM, Michiel de Hoon <mjldehoon@…9…> wrote:

1)The problem does manifest in the same manner through the normal python
prompt.

OK that is good to know.

  1. I’m not sure what is meant by a “framework install.” Everything (except MPL 99.1.1)
    was installed through fink.

This is important. Check where python is installed. If ‘which python’ shows /Library/Frameworks/Python.framework/Versions/2.6/bin/python or something similar, you have a framework version. If on the other hand it shows /usr/bin/python, /usr/local/bin/python, or something similar, you don’t have a framework version. I don’t know what fink installs by default. If you don’t have Python installed as a framework, some backends (including the MacOSX backend) will not interact properly with the window manager. This is a Mac peculiarity. If you build Python from source, you can specify to install a framework version by passing the --enable-framework option to the configure script.

  1. Although I use x11 and not the native Mac terminal, I’m not sure if this requires me to > install different packages for the gui stuff. Could you guys expand on this, please?

Some backends go make use of X11 (e.g., the gtkcairo backend), others do not (e.g., the MacOSX backend). The MacOSX backend should work with both the native Mac terminal and with an X11 terminal.

–Michiel.

A quick update on Mac backends:

  1. Two others in my office use macports, python 2.6, mpl 99.1, and snowleopard. They have none of the issues I have with the GUI stuff. Most notably, their MacOSX backends work properly in both X11 and native Mac terminal.
  2. I cannot follow up on WxPython or Qt4 for my PPC machine; installs failed for both. I’m working on it some more but have limited time to play around.
  3. A recompile of python through fink using updated gcc/g++ (from 4.0 to 4.2) had no effect.

While I don’t want to drag this thread on forever, I feel like some of this info is useful for the Mac/MPL community. I would love to hear from anyone else who has the OSX backend problem; it seems to be isolated to Fink.

It seems like the bottom line is that depending on your install, some experimentation is required to determine which GUI backends work well or at all.

···

On Tue, May 25, 2010 at 10:51 PM, Daniel Welling <dantwelling@…287…> wrote:

  1. In which case, it’s not a framework install. Fink puts everything into /sw/; there’s nothing to do with pyton in /Library/Frameworks.
    Thanks for the clarification; I’m tempted to get Python from source and try this…

-dw

On Tue, May 25, 2010 at 10:41 PM, Michiel de Hoon <mjldehoon@…9…> wrote:

1)The problem does manifest in the same manner through the normal python
prompt.

OK that is good to know.

  1. I’m not sure what is meant by a “framework install.” Everything (except MPL 99.1.1)
    was installed through fink.

This is important. Check where python is installed. If ‘which python’ shows /Library/Frameworks/Python.framework/Versions/2.6/bin/python or something similar, you have a framework version. If on the other hand it shows /usr/bin/python, /usr/local/bin/python, or something similar, you don’t have a framework version. I don’t know what fink installs by default. If you don’t have Python installed as a framework, some backends (including the MacOSX backend) will not interact properly with the window manager. This is a Mac peculiarity. If you build Python from source, you can specify to install a framework version by passing the --enable-framework option to the configure script.

  1. Although I use x11 and not the native Mac terminal, I’m not sure if this requires me to > install different packages for the gui stuff. Could you guys expand on this, please?

Some backends go make use of X11 (e.g., the gtkcairo backend), others do not (e.g., the MacOSX backend). The MacOSX backend should work with both the native Mac terminal and with an X11 terminal.

–Michiel.

Daniel Welling wrote:

A quick update on Mac backends:

While I don't want to drag this thread on forever, I feel like some of this info is useful for the Mac/MPL community. I would love to hear from anyone else who has the OSX backend problem; it seems to be isolated to Fink.

I'm still a bit confused -- are you having MPL problems or GUI toolkit problems? i.e. do wx, gtk, qt, etc work just fine for non-MPL applications. If so then there is an MPL issue which it would be nice to resolve. If not, then you have GUI toolkit issues, which should be addressed by the fink and/or GUI toolkit developers.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

We can actually check from Python whether it’s a framework install or not.

import MacOS
MacOS.WMAvailable()
returns True if it’s a framework install, False if not.
I can add this check to the MacOSX backend and print out a warning if it’s not a framework install.
–Michiel

···

— On Wed, 5/26/10, Daniel Welling <dantwelling@…287…> wrote:

From: Daniel Welling <dantwelling@…287…>
Subject: Re: [Matplotlib-users] Mac backend problems for nearly all backends.
To: “Michiel de Hoon” <mjldehoon@…9…>
Cc: matplotlib-users@lists.sourceforge.net
Date: Wednesday, May 26, 2010, 12:51 AM

  1. In which case, it’s not a
    framework install. Fink puts everything into /sw/; there’s nothing to do with pyton in /Library/Frameworks.
    Thanks for the clarification; I’m tempted to get Python from source and try this…

-dw

On Tue, May 25, 2010 at 10:41 PM, Michiel de Hoon <mjldehoon@…9…> wrote:

1)The problem does manifest in the same manner through the normal python
prompt.

OK that is good to know.

  1. I’m not sure what is meant by a “framework install.” Everything (except MPL 99.1.1)
    was installed through fink.

This is important. Check where python is installed. If ‘which python’ shows /Library/Frameworks/Python.framework/Versions/2.6/bin/python or something similar, you have a framework version. If on the other hand it shows /usr/bin/python, /usr/local/bin/python, or something similar, you don’t have a framework version. I don’t know what fink installs by default. If you don’t have Python installed as a framework, some backends (including the MacOSX backend) will not interact properly with the window manager. This is a Mac peculiarity. If you build Python from source, you can specify to install a framework version by passing the --enable-framework option to the configure script.

  1. Although I use x11 and not the native Mac terminal, I’m not sure if this requires me to > install different packages for the gui stuff. Could you guys expand on this, please?

Some backends go make use of X11 (e.g., the gtkcairo backend), others do not (e.g., the MacOSX backend). The MacOSX backend should work with both the native Mac terminal and with an X11 terminal.

–Michiel.