Matplotlib + py2exe = frustration

Thanks for all the help. I'm packing to head home, so I won't be able to work on this again for two weeks.

Maybe I can put this together and put it in the py2exe Wiki.

Michael Huster, Ph. D.
Assistant Professor of Science
Simpson University
2211 College View Dr.
Redding, CA 96003

···

-----Original Message-----
From: Noko Phala [mailto:nphala@…681…]
Sent: Wed 8/10/2005 9:58 PM
To: Michael Huster
Subject: RE: [Matplotlib-users] Matplotlib + py2exe = frustration

I feel your pain. After a billion tries, I got a similar
scipy+matplotlib app to work with the following (a few scipy-specific
modules, like integrate, had to be called from the main script itself:)

from distutils.core import setup
import py2exe
import glob
import os

#for matplotlib
data=glob.glob(r'C:\Python23\share\matplotlib\*')
data.append(r'C:\Python23\share\matplotlib\matplotlibrc')

options = {
    "py2exe": {
        "includes": ['scipy','scipy.integrate','matplotlib.*',
                     'scipy.special.*','scipy.linalg.*','scipy.*',\
                             ],
        "packages":
['encodings','matplotlib.numerix.random_array','pytz',\
                     'dateutil','numarray'
],
        
        }
    }

setup(
    
    version = "0.1.1",
    console = ["C:\Python23\myscript.py"],
    data_files = [("matplotlibdata",data)],
    options=options
    
    )

Good luck,

Dr Noko Phala
Process Research
Anglo Research
PO Box 106 Crown Mines 2025
Republic of South Africa
Tel: +27 (11) 377 4817
e-mail: nphala@...681...
         
-----Original Message-----
From: matplotlib-users-admin@lists.sourceforge.net
[mailto:matplotlib-users-admin@lists.sourceforge.net] On Behalf Of
Michael Huster
Sent: Wednesday, August 10, 2005 6:09 PM
To: Matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] Matplotlib + py2exe = frustration

I cross-posted this on py2exe-users w/o getting help yet.

Yes, I've read the Wiki -
http://starship.python.net/crew/theller/moin.cgi/MatPlotLib
and any other pages I could google. I want to package a pylab (aka
scipy, aka matplotlib) app. I'm on Win XP. I've been trying for four
days. I've boiled it down to this:

-----------------------------------------------------
Test.py:
import pylab
a = arange(10)
print a

-----------------------------------------------------
Setup.py:
from distutils.core import setup
import py2exe
import glob

# from py2exe wiki: matplotlib
"""
These don't work so I commented them out:
opts = {
    'py2exe': { 'excludes': ['_gtkagg', '_tkagg'],
                'dll_excludes': ['libgdk-win32-2.0-0.dll',
                                 'libgobject-2.0-0.dll'],
                'includes': ['matplotlib.numerix.random_array'],
              }
       }
"""

setup(
    # This doesn't make it work either:
    data_files = [
                  (r'lib\matplotlibdata',
glob.glob(r'c:\python23\share\matplotlib\*')),
                  (r'lib\matplotlibdata',
glob.glob(r'c:\Python23\share\matplotlib\.matplotlibrc')),
                  ],
    version = "0.7.0",
    description = "test py2exe & pylab",
    name = "TestPy2exe",
    author = "Michael E Huster",
    # targets to build
    console = ["test.py"]

    )
-----------------------------------------------------
I run:

python setup.py py2exe
cd dist
test.exe

Traceback (most recent call last):
  File "test.py", line 1, in ?
  File "pylab.pyc", line 1, in ?
  File "matplotlib\__init__.pyc", line 509, in ?
  File "matplotlib\__init__.pyc", line 245, in wrapper
  File "matplotlib\__init__.pyc", line 318, in _get_data_path
RuntimeError: Could not find the matplotlib data files

Michael Huster, Ph. D.
Assistant Professor of Science
Simpson University
2211 College View Dr.
Redding, CA 96003

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing &
QA
Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users