>Hi, Travis >I can pack my scripts into an executable with py2exe, but errors occur >once it runs:
>No scipy-style subpackage 'random' found in D:\test\dist\numpy. >Ignoring: No module named info >import core -> failed: No module named _internal >import lib -> failed: 'module' object has no attribute '_ARRAY_API' >import linalg -> failed: 'module' object has no attribute '_ARRAY_API' >import dft -> failed: 'module' object has no attribute '_ARRAY_API' >Traceback (most recent call last): > File "main.py", line 9, in ? > File "numpy\__init__.pyc", line 49, in ? > > File "numpy\add_newdocs.pyc", line 2, in ? > gkDc > 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 I am cross referencing this from the py2exe mailing list. There seems to have been a fix for this problem #---------------------------begining of setup.py--------------------# 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 ) #--------------------------End of setup.py--------------# >>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? the setup.py was from the person who wrote the instructions for this fix. also here is my setup.py just for reference although mine is probably incorrect due to me being new with py2exe #------------------------setup.py------------------------# 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])) setup( console=['templatewindow.py'], options={ "py2exe": { "compressed": 1, "optimize": 2, "packages": ["encodings", "kinterbasdb", "pytz.zoneinfo.UTC", "matplotlib.numerix", ], "dll_excludes": ["tcl84.dll", "tk84.dll"] } mpldata = glob.glob(r'C:\Python24\share\matplotlib\*') mpldata.append(r'C:\Python24\share\matplotlib\.matplotlibrc') data_files = [("prog\\locale\\fr\\LC_MESSAGES", mylocaleFR), ("prog\\locale\\de\\LC_MESSAGES", mylocaleDE), ("prog\\locale\\en\\LC_MESSAGES", mylocaleEN), ... ("matplotlibdata", mpldata), ("prog\\amaradata", amaradata), ("prog\\amaradata\\Schemata", amaraschemata), ] ) #-----------------------EOF-----------------# I was receiving this same "AttributeError: 'module' object has no attribute '_ARRAY_API'" error, and i did the same thing this person did, unzipped the folder, put the _internal.pyc file in the numpy/core folder and then rezipped the folder and I am receiving a wx error, but the numpy array_api error is gone. You may want to check this out and let us know if it works for you also. -Kenny p.s. i tried sending this 4 times prior but believe it did not send because it was alot longer so i shortened it, sorry if it posted 4 times ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion