From: Emmanuel <man...@gm...> - 2007-09-18 16:43:50
|
Hi, I got the setup.py given by Werner in an old thread (message from april 4th 2007). I putted code thereafter. I installed matplotlib 0.90.1/ python 2.5 on windows XP When I run the setup, it make an exception when using matplotlib.get_py2exe_datafiles() : --> 13 mpdir, mpfiles = matplotlib.get_py2exe_datafiles() C:\Python25\Lib\site-packages\matplotlib\__init__.py in get_py2exe_datafiles() 367 mplfiles = glob.glob(os.sep.join([get_data_path(), '*'])) 368 # Need to explicitly remove cocoa_agg files or pyexe complains 369 mplfiles.remove(os.sep.join([get_data_path(), 'Matplotlib.nib'])) 370 The problem is the same with the simple setup.py found on the py2exe website: from distutils.core import setup import py2exe import sys #sys.argv.append('py2exe') import matplotlib setup( console=['simple_plot.py'], options={ 'py2exe': { 'packages' : ['matplotlib', 'pytz'], } }, data_files=[matplotlib.get_py2exe_datafiles()] ) # -*- coding: iso-8859-1 -*-# from distutils.core import setup import os from os.path import join import shutil import glob import py2exe from py2exe.build_exe import py2exe import sys import matplotlib mpdir, mpfiles = matplotlib.get_py2exe_datafiles() # cleanup dist and build directory first (for new py2exe version) if os.path.exists("dist/prog"): shutil.rmtree("dist/prog") if os.path.exists("dist/lib"): shutil.rmtree("dist/lib") if os.path.exists("build"): shutil.rmtree("build") # # A program using wxPython # The manifest will be inserted as resource into the .exe. This # gives the controls the Windows XP appearance (if run on XP ;-) # manifest_template = ''' <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="5.0.0.0" processorArchitecture="x86" name="%(prog)s" type="win32" /> <description>%(prog)s</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="AsInvoker" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> </assembly> ''' RT_MANIFEST = 32 # # options for py2exe options = {"py2exe": {"compressed": 1, "optimize": 2, "packages": ["encodings", "pytz.zoneinfo.UTC", "matplotlib.numerix", "matplotlib.backends.backend_tkagg" ], "excludes": ["MySQLdb", ], "dll_excludes": ["wxmsw26uh_vc.dll"] } } zipfile = r"lib\library.zip" class MetaBase: def __init__(self, **kw): self.__dict__.update(kw) self.version = '1.0' self.author = "yourname" self.author_email = "na...@wh..." self.company_name = "" self.copyright = "2003 - 2007 by whoever" self.url = "http://www.whatever.com/" self.download_url = "http://www.whatever.com/en/" self.trademark = "" self.comments = "a comment on the prog" self.name = "the prog name" self.description = "a desc on the prog" wx_emb = MetaBase( script = "simple_plot.py", other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="your prog name"))], ## icon_resources = [(1, r"images/some.ico")], dest_base = r"prog\simple_plot") setup( classifiers = ["Copyright:: your name", "Development Status :: 5 Stable", "Intended Audience :: End User", "License :: Shareware", "Operating System :: Microsoft :: Windows 2000", "Operating System :: Microsoft :: Windows XP", "Operating System :: Microsoft :: Windows 9x", "Programming Language :: Python, wxPython", "Topic :: Home Use" "Natural Language :: German", "Natural Language :: French", "Natural Language :: English"], windows = [wx_emb], options = options, zipfile = zipfile, data_files = [("lib\\matplotlibdata", mpfiles), ## matplotlib.get_py2exe_datafiles(), # if you don't use the lib option ] ) #!/usr/bin/env python """ Example: simple line plot. Show how to make and save a simple line plot with labels, title and grid """ from pylab import * t = arange(0.0, 1.0+0.01, 0.01) s = cos(2*2*pi*t) plot(t, s) xlabel('time (s)') ylabel('voltage (mV)') title('About as simple as it gets, folks') grid(True) #savefig('simple_plot.png') savefig('simple_plot') show() |
From: Emmanuel <man...@gm...> - 2007-09-18 20:04:57
|
Hi, I got the setup.py given by Werner in an old thread (message from april 4th 2007). I putted code thereafter. I installed matplotlib 0.90.1/ python 2.5 on windows XP When I run the setup, it make an exception when using matplotlib.get_py2exe_datafiles() : --> 13 mpdir, mpfiles = matplotlib.get_py2exe_datafiles() C:\Python25\Lib\site-packages\matplotlib\__init__.py in get_py2exe_datafiles() 367 mplfiles = glob.glob (os.sep.join([get_data_path(), '*'])) 368 # Need to explicitly remove cocoa_agg files or pyexe complains 369 mplfiles.remove(os.sep.join([get_data_path(), 'Matplotlib.nib'])) 370 The problem is the same with the simple setup.py found on the py2exe website: from distutils.core import setup import py2exe import sys #sys.argv.append('py2exe') import matplotlib setup( console=['simple_plot.py'], options={ 'py2exe': { 'packages' : ['matplotlib', 'pytz'], } }, data_files=[matplotlib.get_py2exe_datafiles()] ) # -*- coding: iso-8859-1 -*-# from distutils.core import setup import os from os.path import join import shutil import glob import py2exe from py2exe.build_exe import py2exe import sys import matplotlib mpdir, mpfiles = matplotlib.get_py2exe_datafiles() # cleanup dist and build directory first (for new py2exe version) if os.path.exists("dist/prog"): shutil.rmtree("dist/prog") if os.path.exists("dist/lib"): shutil.rmtree("dist/lib") if os.path.exists("build"): shutil.rmtree("build") # # A program using wxPython # The manifest will be inserted as resource into the .exe. This # gives the controls the Windows XP appearance (if run on XP ;-) # manifest_template = ''' <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion=" 1.0"> <assemblyIdentity version="5.0.0.0" processorArchitecture="x86" name="%(prog)s" type="win32" /> <description>%(prog)s</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> <trustInfo xmlns="urn:schemas-microsoft-com: asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="AsInvoker" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> </assembly> ''' RT_MANIFEST = 32 # # options for py2exe options = {"py2exe": {"compressed": 1, "optimize": 2, "packages": ["encodings", "pytz.zoneinfo.UTC", "matplotlib.numerix", "matplotlib.backends.backend_tkagg" ], "excludes": ["MySQLdb", ], "dll_excludes": ["wxmsw26uh_vc.dll"] } } zipfile = r"lib\library.zip" class MetaBase: def __init__(self, **kw): self.__dict__.update(kw) self.version = '1.0' self.author = "yourname" self.author_email = "na...@wh..." self.company_name = "" self.copyright = "2003 - 2007 by whoever" self.url = "http://www.whatever.com/" self.download_url = "http://www.whatever.com/en/" self.trademark = "" self.comments = "a comment on the prog" self.name = "the prog name" self.description = "a desc on the prog" wx_emb = MetaBase( script = "simple_plot.py", other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="your prog name"))], ## icon_resources = [(1, r"images/some.ico")], dest_base = r"prog\simple_plot") setup( classifiers = ["Copyright:: your name", "Development Status :: 5 Stable", "Intended Audience :: End User", "License :: Shareware", "Operating System :: Microsoft :: Windows 2000", "Operating System :: Microsoft :: Windows XP", "Operating System :: Microsoft :: Windows 9x", "Programming Language :: Python, wxPython", "Topic :: Home Use" "Natural Language :: German", "Natural Language :: French", "Natural Language :: English"], windows = [wx_emb], options = options, zipfile = zipfile, data_files = [("lib\\matplotlibdata", mpfiles), ## matplotlib.get_py2exe_datafiles(), # if you don't use the lib option ] ) #!/usr/bin/env python """ Example: simple line plot. Show how to make and save a simple line plot with labels, title and grid """ from pylab import * t = arange(0.0, 1.0+0.01, 0.01) s = cos(2*2*pi*t) plot(t, s) xlabel('time (s)') ylabel('voltage (mV)') title('About as simple as it gets, folks') grid(True) #savefig('simple_plot.png') savefig('simple_plot') show() |
From: Ron A. <Ron...@st...> - 2008-09-21 01:18:08
Attachments:
setup1.py
|
I followed the thread in Sept 2007 that covers the same problem I am having, but it seems to just end without a solution. I have attached the setup file I am using. When my application is packaged, installed and I try to get my graph I get the following message. The graph works fine while I am working from just the python script in idle. Traceback (most recent call last): File "WxPyETn.py", line 4070, in GetRevGraph File "matplotlib\__init__.pyc", line 677, in <module> File "matplotlib\__init__.pyc", line 598, in rc_params File "matplotlib\__init__.pyc", line 552, in matplotlib_fname File "matplotlib\__init__.pyc", line 242, in wrapper File "matplotlib\__init__.pyc", line 482, in _get_data_path_cached File "matplotlib\__init__.pyc", line 478, in _get_data_path RuntimeError: Could not find the matplotlib data files I really try to avoid posting and believe me, I have spent hours trying to figure a solution, but I am just plain ignorant with this and I feel there is a common solution out there someplace. Ron Adelman, CGFM Fiscal Consultant Dept. of Education (SouthWest District) 314 E. Main Jackson, TN 38301 Phone: 731-927-8787 State Cell: 615-306-4062 Cell: 731-697-0967 Fax: 731-422-1406 |
From: Laurent D. <lau...@gm...> - 2008-09-21 12:28:09
Attachments:
setup_pylab.py
|
Had the same problem, solved with the setup.py attached ;) Just modify it to fit your needs, should be a good start. Works under vista + matplotlib 0.98.3 Cheers Laurent > -----Message d'origine----- > De : Ron Adelman [mailto:Ron...@st...] > Envoyé : samedi 20 septembre 2008 23:17 > À : mat...@li... > Objet : [Matplotlib-users] py2exe with pylab > > I followed the thread in Sept 2007 that covers the same problem I am > having, but it seems to just end without a solution. > > I have attached the setup file I am using. When my application is > packaged, installed and I try to get my graph I get the following > message. The graph works fine while I am working from just the python > script in idle. > > Traceback (most recent call last): > File "WxPyETn.py", line 4070, in GetRevGraph > File "matplotlib\__init__.pyc", line 677, in <module> > File "matplotlib\__init__.pyc", line 598, in rc_params > File "matplotlib\__init__.pyc", line 552, in matplotlib_fname > File "matplotlib\__init__.pyc", line 242, in wrapper > File "matplotlib\__init__.pyc", line 482, in _get_data_path_cached > File "matplotlib\__init__.pyc", line 478, in _get_data_path > RuntimeError: Could not find the matplotlib data files > > I really try to avoid posting and believe me, I have spent hours trying > to figure a solution, but I am just plain ignorant with this and I > feel there is a common solution out there someplace. > > > Ron Adelman, CGFM > Fiscal Consultant > Dept. of Education (SouthWest District) > 314 E. Main > Jackson, TN 38301 > Phone: 731-927-8787 > State Cell: 615-306-4062 > Cell: 731-697-0967 > Fax: 731-422-1406 |
From: Werner F. B. <wer...@fr...> - 2007-09-18 20:53:40
Attachments:
setup.py
|
Oops, forgot to copy the list. Hi Emmanuel, Emmanuel wrote: > Hi, > > I got the setup.py given by Werner in an old thread (message from > april 4th 2007). I putted code thereafter. This is probably out of date for 0.90. I attach the one I updated at some point, also I am not sure that how I deal with the fonts folder is the best/most elegant way but it does the trick for me. I just tried it out to be sure that it is working with WinVista, Python 2.5.1 and mp 0.90.1 Hope it helps Werner |
From: Emmanuel <emm...@fa...> - 2007-09-19 20:33:44
|
With the setup you provided. I could get py2exe to make an exe of the simple_plot.py from simple_plot_wxagg of py2exe examples. When I tried this on another python prog, I remarked that if I comment the following line : import matplotlib.backends.backend_wxagg the exe created by py2exe crash and the log tells us : Traceback (most recent call last): File "entropia.py", line 6, in <module> File "pylab.pyo", line 1, in <module> File "matplotlib\pylab.pyo", line 222, in <module> File "matplotlib\backends\__init__.pyo", line 24, in pylab_setup ImportError: No module named backend_wxagg I think the same kind of problem may append with the default backend tkagg... |
From: Werner F. B. <wer...@fr...> - 2007-09-20 08:49:43
|
Hi Emmanuel, Emmanuel wrote: > With the setup you provided. I could get py2exe to make an exe of the > simple_plot.py from simple_plot_wxagg of py2exe examples. I use matplotlib only from within wxPython, that is why I used this example script. Which of the matplotlib example script is closest to what you want to do? If you let me know I try to create/adapt the setup.py for it. Werner |