From: tristan C. <tco...@ya...> - 2006-08-29 10:01:55
|
Hello, I am having troubles with py2exe and numpy/matplotlib... Configuration : Windows XP pro ActivePython 2.4.2.10 Scipy 0.4.9 Numpy 0.9.8 MatplotLib 0.87.1 Py2exe 0.6.5 WxPython 2.6 I am using the following setup.py file: #--------------------------------------------------------- from distutils.core import setup import py2exe from distutils.filelist import findall import os import matplotlib matplotlibdatadir = matplotlib.get_data_path() matplotlibdata = findall(matplotlibdatadir) matplotlibdata_files = [] for f in matplotlibdata: dirname = os.path.join('matplotlibdata', f[len(matplotlibdatadir)+1:]) matplotlibdata_files.append((os.path.split(dirname)[0], [f])) packages = ['matplotlib', 'pytz'] includes = [] excludes = [] dll_excludes = ['libgdk_pixbuf-2.0-0.dll', 'libgobject-2.0-0.dll', 'libgdk-win32-2.0-0.dll', 'wxmsw26uh_vc.dll'] opts = { 'py2exe': { 'packages' : packages, 'includes' : includes, 'excludes' : excludes, 'dll_excludes' : dll_excludes } } setup ( console=['test.py'], options = opts, data_files = matplotlibdata_files ) #----------------------------- EOF --------------------------- I compile the application by running ">setup.py py2exe" At the end of compilation phase, it is written : The following modules appear to be missing ['AppKit', 'FFT', 'Foundation', 'Image', 'LinearAlgebra', 'MA', 'MLab', 'Matrix', 'Numeric', 'PyObjCTools', 'P yQt4', 'Pyrex', 'Pyrex.Compiler', 'RandomArray', '_curses', '_ssl', 'backends.draw_if_interactive', 'backends. new_figure_manager', 'backends.pylab_setup', 'backends.show', 'cairo', 'cairo.gtk', 'fcompiler.FCompiler', 'fc ompiler.show_fcompilers', 'fltk', 'gd', 'gobject', 'gtk', 'lib.add_newdoc', 'matplotlib.enthought.pyface.actio n', 'mlab.amax', 'mlab.amin', 'numarray', 'numarray.convolve', 'numarray.fft', 'numarray.ieeespecial', 'numarr ay.linear_algebra', 'numarray.linear_algebra.mlab', 'numarray.ma', 'numarray.numeric', 'numarray.random_array' , 'numerix.ArrayType', 'numerix.Complex', 'numerix.Complex32', 'numerix.Complex64', 'numerix.Float', 'numerix. Float32', 'numerix.Float64', 'numerix.Int', 'numerix.Int16', 'numerix.Int32', 'numerix.Int8', 'numerix.NewAxis ', 'numerix.UInt16', 'numerix.UInt32', 'numerix.UInt8', 'numerix.absolute', 'numerix.add', 'numerix.all', 'num erix.allclose', 'numerix.alltrue', 'numerix.arange', 'numerix.arccos', 'numerix.arccosh', 'numerix.arcsin', 'n umerix.arcsinh', 'numerix.arctan', 'numerix.arctan2', 'numerix.arctanh', 'numerix.argmax', 'numerix.argmin', ' numerix.argsort', 'numerix.around', 'numerix.array', 'numerix.arrayrange', 'numerix.asarray', 'numerix.asum', 'numerix.bitwise_and', 'numerix.bitwise_or', 'numerix.bitwise_xor', 'numerix.ceil', 'numerix.choose', 'numerix .clip', 'numerix.compress', 'numerix.concatenate', 'numerix.conjugate', 'numerix.convolve', 'numerix.cos', 'nu merix.cosh', 'numerix.cross_correlate', 'numerix.cumproduct', 'numerix.cumsum', 'numerix.diagonal', 'numerix.d ivide', 'numerix.dot', 'numerix.equal', 'numerix.exp', 'numerix.fabs', 'numerix.fft.fft', 'numerix.fft.inverse _fft', 'numerix.floor', 'numerix.fmod', 'numerix.fromfunction', 'numerix.fromstring', 'numerix.greater', 'nume rix.greater_equal', 'numerix.hypot', 'numerix.identity', 'numerix.indices', 'numerix.innerproduct', 'numerix.i scontiguous', 'numerix.less', 'numerix.less_equal', 'numerix.log', 'numerix.log10', 'numerix.logical_and', 'nu merix.logical_not', 'numerix.logical_or', 'numerix.logical_xor', 'numerix.matrixmultiply', 'numerix.maximum', 'numerix.minimum', 'numerix.mlab.amax', 'numerix.mlab.amin', 'numerix.mlab.cov', 'numerix.mlab.diff', 'numerix .mlab.hanning', 'numerix.mlab.rand', 'numerix.mlab.std', 'numerix.mlab.svd', 'numerix.multiply', 'numerix.nega tive', 'numerix.newaxis', 'numerix.nonzero', 'numerix.not_equal', 'numerix.nx', 'numerix.ones', 'numerix.outer product', 'numerix.pi', 'numerix.power', 'numerix.product', 'numerix.put', 'numerix.putmask', 'numerix.rank', 'numerix.ravel', 'numerix.repeat', 'numerix.reshape', 'numerix.resize', 'numerix.searchsorted', 'numerix.shape ', 'numerix.sin', 'numerix.sinh', 'numerix.size', 'numerix.sometrue', 'numerix.sort', 'numerix.sqrt', 'numerix .subtract', 'numerix.swapaxes', 'numerix.take', 'numerix.tan', 'numerix.tanh', 'numerix.trace', 'numerix.trans pose', 'numerix.typecode', 'numerix.typecodes', 'numerix.where', 'numerix.which', 'numerix.zeros', 'numpy.Comp lex', 'numpy.Complex32', 'numpy.Complex64', 'numpy.Float', 'numpy.Float32', 'numpy.Float64', 'numpy.Infinity', 'numpy.Int', 'numpy.Int16', 'numpy.Int32', 'numpy.Int8', 'numpy.UInt16', 'numpy.UInt32', 'numpy.UInt8', 'nump y.inf', 'numpy.infty', 'numpy.oldnumeric', 'objc', 'paint', 'pango', 'pre', 'pyemf', 'qt', 'setuptools', 'setu ptools.command', 'setuptools.command.egg_info', 'trait_sheet', 'matplotlib.numerix.Float', 'matplotlib.numerix .Float32', 'matplotlib.numerix.absolute', 'matplotlib.numerix.alltrue', 'matplotlib.numerix.asarray', 'matplot lib.numerix.ceil', 'matplotlib.numerix.equal', 'matplotlib.numerix.fromstring', 'matplotlib.numerix.indices', 'matplotlib.numerix.put', 'matplotlib.numerix.ravel', 'matplotlib.numerix.sqrt', 'matplotlib.numerix.take', 'm atplotlib.numerix.transpose', 'matplotlib.numerix.where', 'numpy.core.conjugate', 'numpy.core.equal', 'numpy.c ore.less', 'numpy.core.less_equal', 'numpy.dft.old', 'numpy.random.rand', 'numpy.random.randn'] 1) First Problem: numpy\core\_internal.pyc not included in Library.zip No scipy-style subpackage 'core' found in C:\WinCE\Traces\py2exe test\dist\library.zip\numpy. Ignoring: No module named _internal Traceback (most recent call last): File "profiler_ftt.py", line 15, in ? from matplotlib.backends.backend_wx import Toolbar, FigureCanvasWx,\ File "matplotlib\backends\backend_wx.pyc", line 152, in ? File "matplotlib\backend_bases.pyc", line 10, in ? File "matplotlib\colors.pyc", line 33, in ? File "matplotlib\numerix\__init__.pyc", line 67, in ? File "numpy\__init__.pyc", line 35, in ? File "numpy\_import_tools.pyc", line 173, in __call__ File "numpy\_import_tools.pyc", line 68, in _init_info_modules File "<string>", line 1, in ? File "numpy\lib\__init__.pyc", line 5, in ? File "numpy\lib\type_check.pyc", line 8, in ? File "numpy\core\__init__.pyc", line 6, in ? File "numpy\core\umath.pyc", line 12, in ? File "numpy\core\umath.pyc", line 10, in __load AttributeError: 'module' object has no attribute '_ARRAY_API' I resolved that issue by adding the file ...\Python24\Lib\site-packages\numpy\core\_internal.pyc in ...\test\dist\library.zip\numpy\core. Each time I compile that executable, I add the file by hand. Does anybody know how to automatically add that file? 2) Second problem: I don't know how to resolve that issue: Traceback (most recent call last): File "profiler_ftt.py", line 15, in ? from matplotlib.backends.backend_wx import Toolbar, FigureCanvasWx,\ File "matplotlib\backends\backend_wx.pyc", line 152, in ? File "matplotlib\backend_bases.pyc", line 10, in ? File "matplotlib\colors.pyc", line 33, in ? File "matplotlib\numerix\__init__.pyc", line 67, in ? File "numpy\__init__.pyc", line 35, in ? File "numpy\_import_tools.pyc", line 173, in __call__ File "numpy\_import_tools.pyc", line 68, in _init_info_modules File "<string>", line 1, in ? File "numpy\random\__init__.pyc", line 3, in ? File "numpy\random\mtrand.pyc", line 12, in ? File "numpy\random\mtrand.pyc", line 10, in __load File "numpy.pxi", line 32, in mtrand AttributeError: 'module' object has no attribute 'dtype' I don't find the file numpy.pxi in my file tree nor in \test\dist\library.zip. I browsed the web in the hope to find a solution but nothing. It seems that this issue is well known but no solution provided in mailing lists. What is that file "numpix.pxi"? Where to find it or how is it generated? How to resolve that execution issue? Thanks, Regards, Tristan |
From: tristan C. <tco...@ya...> - 2006-08-29 21:58:08
|
> >1) First Problem: numpy\core\_internal.pyc not included in Library.zip > >C:\Lameness\dist>templatewindow.exe > Traceback (most recent call last): > File "templatewindow.py", line 7, in ? > File "wxmpl.pyc", line 25, in ? > File "matplotlib\numerix\__init__.pyc", line 60, in ? > File "Numeric.pyc", line 91, in ? > File "numpy\__init__.pyc", line 35, in ? > File "numpy\core\__init__.pyc", line 6, in ? > File "numpy\core\umath.pyc", line 12, in ? > File "numpy\core\umath.pyc", line 10, in __load > AttributeError: 'module' object has no attribute '_ARRAY_API' > > > > >I resolved that issue by adding the file > >...\Python24\Lib\site-packages\numpy\core\_internal.pyc in > >...\test\dist\library.zip\numpy\core. > >Each time I compile that executable, I add the file by hand. > >Does anybody know how to automatically add that file? > > although mine was in \python23 respectively :) > > thanks for this fix > now i have this problem > > C:\Lameness\dist>templatewindow.exe > Traceback (most recent call last): > File "c:\python23\lib\site-packages\py2exe\boot_common.py", line 92, in ? > import linecache > ImportError: No module named linecache > Traceback (most recent call last): > File "templatewindow.py", line 1, in ? > ImportError: No module named wx > > C:\Lameness\dist> > > > current setup.py = > > ######################################################## > from distutils.filelist import findall > import os > import matplotlib > matplotlibdatadir = matplotlib.get_data_path() > matplotlibdata = findall(matplotlibdatadir) > matplotlibdata_files = [] > for f in matplotlibdata: > dirname = os.path.join('matplotlibdata', f[len(matplotlibdatadir)+1:]) > matplotlibdata_files.append((os.path.split(dirname)[0], [f])) > > > packages = ['matplotlib', 'pytz'] > includes = [] > excludes = [] > dll_excludes = ['libgdk_pixbuf-2.0-0.dll', > 'libgobject-2.0-0.dll', > 'libgdk-win32-2.0-0.dll', > 'wxmsw26uh_vc.dll'] > > > opts = { 'py2exe': { 'packages' : packages, > 'includes' : includes, > 'excludes' : excludes, > 'dll_excludes' : dll_excludes > } > } > > setup ( console=['templatewindow.py'], > options = opts, > data_files = matplotlibdata_files > ) > ########################################################## > > anyone seen this problem before? > > first line of template window = import wx > My Configuration : Windows XP pro, ActivePython 2.4.2.10, Scipy 0.4.9, Numpy 0.9.8, MatplotLib 0.87.1, Py2exe 0.6.5, WxPython 2.6 ---- 1) Be very careful on how you generate the file "...\dist\library.zip".I don't know why, but the zip file generated by hand doesn't work. Check its size! Specific zip format? Specific options to generate it? I didn't check source files to know how library.zip is generated.My method is the following one: - Extract the ...\test\dist\library.zip file in ...\test\dist\library - Add the file ...\Python24\Lib\site-packages\numpy\core\_internal.pyc in ...\test\dist\library\numpy\core. - Use Winzip to Add the ...\test\dist\library\numpy directory to the ...\dist\library.zip fileI know, it is not really beautiful but it seems to work. It is a temporary solution for debug. I am new in Python so my style is not really "academic" ---- 2) If you use my setup.py file, one more time, be careful cause of the wx specific dll: wxmsw26uh_vc.dllI don't know why, but Py2Exe doesn't find it. I remove that dll from the compilation phase and I copy it by hand in ...\test\dist directory.An idea may be the modification of setup.py file to indicate the path of that dll or something like that.DOES ANYONE HAVE THE SOLUTION? ---- 3)I am still blocked on my second issue > >2) Second problem: I don't know how to resolve that issue:> > > >Traceback (most recent call last):> > File "profiler_ftt.py", line 15, in ?> > from matplotlib.backends.backend_wx import Toolbar, FigureCanvasWx,\> > File "matplotlib\backends\backend_wx.pyc", line 152, in ?> > File "matplotlib\backend_bases.pyc", line 10, in ?> > File "matplotlib\colors.pyc", line 33, in ?> > File "matplotlib\numerix\__init__.pyc", line 67, in ?> > File "numpy\__init__.pyc", line 35, in ?> > File "numpy\_import_tools.pyc", line 173, in __call__> > File "numpy\_import_tools.pyc", line 68, in _init_info_modules> > File "<string>", line 1, in ?> > File "numpy\random\__init__.pyc", line 3, in ?> > File "numpy\random\mtrand.pyc", line 12, in ?> > File "numpy\random\mtrand.pyc", line 10, in __load> > File "numpy.pxi", line 32, in mtrand> >AttributeError: 'module' object has no attribute 'dtype'> > > >I don't find the file numpy.pxi in my file tree nor in \test\dist\library.zip.> >I browsed the web in the hope to find a solution but nothing.> >It seems that this issue is well known but no solution provided in mailing lists.> > > >What is that file "numpix.pxi"? Where to find it or how is it generated?> >How to resolve that execution issue? Regards,Tristan |
From: Grant E. <gr...@vi...> - 2007-08-27 22:14:13
|
On 2006-08-29, tristan CORCELLE <tco...@ya...> wrote: > I am having troubles with py2exe and numpy/matplotlib... Me too. :) > 2) Second problem: I don't know how to resolve that issue: > > Traceback (most recent call last): > File "profiler_ftt.py", line 15, in ? > from matplotlib.backends.backend_wx import Toolbar, FigureCanvasWx,\ > File "matplotlib\backends\backend_wx.pyc", line 152, in ? > File "matplotlib\backend_bases.pyc", line 10, in ? > File "matplotlib\colors.pyc", line 33, in ? > File "matplotlib\numerix\__init__.pyc", line 67, in ? > File "numpy\__init__.pyc", line 35, in ? > File "numpy\_import_tools.pyc", line 173, in __call__ > File "numpy\_import_tools.pyc", line 68, in _init_info_modules > File "<string>", line 1, in ? > File "numpy\random\__init__.pyc", line 3, in ? > File "numpy\random\mtrand.pyc", line 12, in ? > File "numpy\random\mtrand.pyc", line 10, in __load > File "numpy.pxi", line 32, in mtrand > AttributeError: 'module' object has no attribute 'dtype' > > I don't find the file numpy.pxi in my file tree nor in \test\dist\library.zip. > I browsed the web in the hope to find a solution but nothing. > It seems that this issue is well known but no solution provided in mailing lists. I've just run across this exact same error. Has anybody figured out what to do about it? -- Grant Edwards grante Yow! How do I get HOME? at visi.com |
From: Werner F. B. <wer...@fr...> - 2007-08-28 15:18:17
|
Grant Edwards wrote: > > I've just run across this exact same error. Has anybody > figured out what to do about it? > Can either of you provide a small standalone script which gives this error when py2exe it. Also, can you give version information. Werner |
From: Werner F. B. <wb...@us...> - 2007-08-29 09:32:59
|
Grant Edwards wrote: > > I've just run across this exact same error. Has anybody > figured out what to do about it? > Can either of you provide a small standalone script which gives this error when py2exe it. Also, can you provide version information. Werner |
From: Grant E. <gr...@vi...> - 2007-08-29 13:17:42
|
On 2007-08-29, Werner F. Bruhin <wb...@us...> wrote: > Grant Edwards wrote: >> >> I've just run across this exact same error. Has anybody >> figured out what to do about it? > > Can either of you provide a small standalone script which gives this > error when py2exe it. I fixed that problem by enabling the skip_archive option. In order to maximize incompatibility numpy apparently uses its own loader scheme to load its modules. That loader doesn't know how to deal with zipped libraries. The other persistent problem when using many packages is py2exe's inability to deal with the case where multiple packages have modules with the same name: for example, numpy and Numeric both have a multiarray module. py2exe doesn't do the right thing, and one has to manually copy the multiarray.* files from the python library directories into the proper places in the 'dist' folder. This should be a solvable problem. Since the Python compiler has no trouble finding the right module, there must be disambiguation rules that specify what to do. -- Grant Edwards grante Yow! My vaseline is at RUNNING... visi.com |
From: Werner F. B. <wb...@us...> - 2007-08-29 14:58:07
|
Grant Edwards wrote: > On 2007-08-29, Werner F. Bruhin <wb...@us...> wrote: >> Grant Edwards wrote: >>> I've just run across this exact same error. Has anybody >>> figured out what to do about it? >> Can either of you provide a small standalone script which gives this >> error when py2exe it. > > I fixed that problem by enabling the skip_archive option. In > order to maximize incompatibility numpy apparently uses its own > loader scheme to load its modules. That loader doesn't know > how to deal with zipped libraries. > > The other persistent problem when using many packages is > py2exe's inability to deal with the case where multiple > packages have modules with the same name: for example, numpy > and Numeric both have a multiarray module. py2exe doesn't do > the right thing, and one has to manually copy the multiarray.* > files from the python library directories into the proper places > in the 'dist' folder. This should be a solvable problem. Since > the Python compiler has no trouble finding the right module, > there must be disambiguation rules that specify what to do. > This is a bit over my head, but maybe using the zipfile option is of help here. It creates a folder lib and puts numpy, encodings etc into a zip file and within the path to numpy etc is preserved. Couldn't that solve the issue with using both numpy and Numeric? Werner |