MatPlotLib + Py2exe, backend problems ...

hello,

I'm trying to create a distro with py2exe, including MatPlotLib.
After finally resolving the matplotlib datapath problem,
I bumped into a new problem concerning backends.

I'm using MatPlotLib 0.91.2
I only need the wx-Backend.

In Py2exe I tried to exclude as many backends as possible,
but the excludes seems to have no effect.
      'excludes' : [
         '_gtkagg', '_tkagg', '_agg2', '_cairo', '_cocoaagg',
         '_fltkagg', '_gtk', '_gtkcairo',
         'backend_qt', 'backend_qt4', 'backend_qt4agg',
         'backend_qtagg',
         'backend_cairo', 'backend_cocoaagg',
         'Tkconstants', 'Tkinter', 'tcl',
         "_imagingtk", "PIL._imagingtk", "ImageTk", "PIL.ImageTk", "FixTk"
          ],

The creating of the distro seems to work,
but the distro won't run,
because of some problems with tk-backends, (which I don't need or even want).

The problem might be caused by a crashed installation of tk in the past.
And might also be amplified by the fact that I use
   from pylab import *

Now I guess I can effectively remove the unnecessary backends,
by removing the following lines from \backends\__init__.py

interactive_bk = ['GTK', 'GTKAgg', 'GTKCairo', 'FltkAgg', 'QtAgg', 'Qt4Agg',
                  'TkAgg', 'WX', 'WXAgg', 'CocoaAgg']
non_interactive_bk = ['Agg2', 'Agg', 'Cairo', 'EMF', 'GDK',
                      'Pdf', 'PS', 'SVG', 'Template']

I don't know if this solves the problem (haven't tried it yet),
but I certainly thinks this is not the proper way to go.

Any solution / suggestion would be very welcome (while MatPlotLib is quit essential in my distro)

thanks,
Stef Mientki

I am not sure why the excluding is not working, but it shouldn't
affect you app. If you are setting the backend in matplotlibrc, and
successfully distributing this file, then matplotlib will only try and
load that backend and the presence or abscense of the others shouldn't
matter. In recent versions of matplotlib (eg the 91.2 version you are
using), you can control the build process with setup.cfg.

JDH

···

On Feb 16, 2008 5:19 AM, Stef Mientki <s.mientki@...1882...> wrote:

In Py2exe I tried to exclude as many backends as possible,
but the excludes seems to have no effect.
      'excludes' : [
         '_gtkagg', '_tkagg', '_agg2', '_cairo', '_cocoaagg',
         '_fltkagg', '_gtk', '_gtkcairo',
         'backend_qt', 'backend_qt4', 'backend_qt4agg',
         'backend_qtagg',
         'backend_cairo', 'backend_cocoaagg',
         'Tkconstants', 'Tkinter', 'tcl',
         "_imagingtk", "PIL._imagingtk", "ImageTk", "PIL.ImageTk", "FixTk"
          ],

John Hunter wrote:

In Py2exe I tried to exclude as many backends as possible,
but the excludes seems to have no effect.
      'excludes' : [
         '_gtkagg', '_tkagg', '_agg2', '_cairo', '_cocoaagg',
         '_fltkagg', '_gtk', '_gtkcairo',
         'backend_qt', 'backend_qt4', 'backend_qt4agg',
         'backend_qtagg',
         'backend_cairo', 'backend_cocoaagg',
         'Tkconstants', 'Tkinter', 'tcl',
         "_imagingtk", "PIL._imagingtk", "ImageTk", "PIL.ImageTk", "FixTk"
          ],
    
I am not sure why the excluding is not working, but it shouldn't
affect you app. If you are setting the backend in matplotlibrc, and
successfully distributing this file, then matplotlib will only try and
load that backend and the presence or abscense of the others shouldn't
matter. In recent versions of matplotlib (eg the 91.2 version you are
using), you can control the build process with setup.cfg.
  

What is setup.cfg, where can I find it and where can I get information about it ?

thanks,
Stef Mientki

···

On Feb 16, 2008 5:19 AM, Stef Mientki <s.mientki@...1882...> wrote:
JDH

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@...229...
For additional commands, e-mail: wxPython-users-help@...229...

Let's keep this on matplotlib-users so we don't annoy the good folks
at the wxpython and distutils lists...

setup.cfg is a build/configure file that ships w/ matplotlib in recent
versions (0.91.x). If it is not in your source distribution, let us
know which distro you are using, where you got it from, what you have
already, etc.... Among other things, it lets you conditionally turn
of/off builds of certain GUI backends and other optional features.

JDH

···

On Feb 18, 2008 1:11 PM, Stef Mientki <s.mientki@...1882...> wrote:

What is setup.cfg, where can I find it and where can I get information
about it ?

hi John,

John Hunter wrote:

What is setup.cfg, where can I find it and where can I get information
about it ?
    
Let's keep this on matplotlib-users so we don't annoy the good folks
at the wxpython and distutils lists...
  

If you google for this problem you will be surprised how many people bump into these two problem,
( matplot datafiles and the tk-issue )
But ok, let's first find the solution :wink:

setup.cfg is a build/configure file that ships w/ matplotlib in recent
versions (0.91.x). If it is not in your source distribution, let us
know which distro you are using,

__version__ = '0.91.2'
__revision__ = '$Revision: 4802 $'
__date__ = '$Date: 2008-01-06 12:10:34 -0500 (Sun, 6 Jan 2008) $'

where you got it from,

probably: http://sourceforge.net/project/showfiles.php?group_id=80706
matplotlib-0.91.2.win32-py2.4.exe

what you have
already, etc....

Although I don't see how this can delete a setup.cfg from matplotlib, ..
Windows XP, SP2
Python 2.4
Scipy (enthought edition), with a crashed update through eggs enstaller :-(, but everything stiil seems to work fine
wxPython 2.8 msw ansi

btw, i just saw this on "matplotlibrc"
#### CONFIGURATION BEGINS HERE
# the default backend; one of GTK GTKAgg GTKCairo FltkAgg QtAgg TkAgg
# WX WXAgg Agg Cairo GD GDK Paint PS PDF SVG Template
backend : TkAgg
numerix : numpy # numpy, Numeric or numarray

cheers,
Stef

···

On Feb 18, 2008 1:11 PM, Stef Mientki <s.mientki@...1882...> wrote:
  Among other things, it lets you conditionally turn
of/off builds of certain GUI backends and other optional features.

JDH

I'm not an expert but I thought I'd try and help...

> where you got it from,
probably: http://sourceforge.net/project/showfiles.php?group_id=80706
matplotlib-0.91.2.win32-py2.4.exe

This is a binary distribution, that is one that has already been
compiled on a different machine. This won't have the setup.cfg file,
since it is a file that is used to configure the compilation process
of matplotlib. Also this is why you can only use this distribution
with specific versions of python, wx etc.

If you choose to compile matplotlib yourself, then you have the option
of completely disabling some of the backends, which is done via a
setting in the setup.cfg file.

I am not sure how easy it is to build matplotlib on windows, but on
other platforms it is relatively straightforward.
After obtaining the source distribution, ensure you have the
requirements (including any development files) for the backends you
want. Select the backends to build in setup.cfg and run
python setup.py build
followed by
python setup.py install

Hope this at least clears up the missing setup.cfg issue...

Robin

···

On Feb 19, 2008 7:15 PM, Stef Mientki <stef.mientki@...287...> wrote:

Stef,

Stef Mientki wrote:

...
btw, i just saw this on "matplotlibrc"
#### CONFIGURATION BEGINS HERE
# the default backend; one of GTK GTKAgg GTKCairo FltkAgg QtAgg TkAgg
# WX WXAgg Agg Cairo GD GDK Paint PS PDF SVG Template
backend : TkAgg
numerix : numpy # numpy, Numeric or numarray

I think this is your problem, I have:
backend : WXAgg
numerix : numpy # numpy, Numeric or numarray

Hope this gets it cleared.
Werner

Hi Robin and Stef,

Robin wrote:

....
This is a binary distribution, that is one that has already been
compiled on a different machine. This won't have the setup.cfg file,
since it is a file that is used to configure the compilation process
of matplotlib. Also this is why you can only use this distribution
with specific versions of python, wx etc.
  

I am under the impression that as of mpl 0.9x there is NO specific
version dependency for wxPython. I believe there was some optimization
code which forced a dependency on wxPython 2.6 Unicode for the wxAgg
backend.

Werner