|
I got this to run, but it’s a pretty
sad hack. Looks like numpy has some sort of ‘custom’ package
import, so I just rolled the numpy distribution into a PKG and then extracted
that into the _MEIPASS2 dir ( I am using –onefile ). Anyway for anyone
else out there the code is below, but first, here is a link that helped me
quite a bit, since I am using Matplotlib as well.. http://www.mail-archive.com/[email protected]/msg00160.html I would add that I had to tweak the
matplotlib __init__ files as follows.. matplotlib.__init__:184 _havedate = False matplotlib.numerix.__init__ Comment out random_array import , lines 97
and 101 I also had to import the backend I am
using specifically in matplotlib.backends.__init__ import backend_agg Now for the PKG code, there is the modification
to the spec files to add the PKG archives, and then the code added to my
program to read in the archives. The link above explains this better. To the spec file we make these
modifications.. a = Analysis( …. } # added this numpy_pkg = PKG( Tree(
'/work/deva/aif/lib/python2.4/site-packages/numpy' ), name='numpy.pkg' ) import
matplotlib matplotpkg = PKG(
Tree(matplotlib._get_data_path()),name='mpl-data.pkg') # end add block exe = EXE( pyz, matplotpkg, # add numpy_pkg, # add …. Rest of it Now to the start of the actual script.. import carchive # start for installer def unpack_dir( package_name, dir_name ): this =
carchive.CArchive(sys.executable) mp = this.openEmbedded(package_name) targetdir = os.environ['_MEIPASS2'] targetdir =
os.path.join(targetdir,dir_name) os.mkdir(targetdir) print "Extracting %s data
..." % package_name, for fnm in mp.contents(): try: stuff = mp.extract(fnm)[1] outnm =
os.path.join(targetdir, fnm) dirnm = os.path.dirname(outnm) if not os.path.exists(dirnm): os.makedirs(dirnm) open(outnm, 'wb').write(stuff) except Exception,mex: print mex mp = None print "ok" return targetdir if os.environ.has_key( '_MEIPASS2' ): targetdir = unpack_dir( 'mpl-data.pkg',
'mpl-data' ) os.environ["MATPLOTLIBDATA"] =
targetdir os.putenv("MATPLOTLIBDATA",
targetdir) targetdir = unpack_dir( 'numpy.pkg',
'numpy' ) Sorry for the rambling nature of the post,
but I figure it’s better to put the information up than not.. S From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kuzminski, Stefan R Hi, I’m trying to use PyInstaller 1.2 with Numpy 0.9.6 and
getting the stack trace below ( it builds the executable but that fails when
run ). Sorry if this has been addressed before, I wish Pipermail had a
search function for the mailing list.. Given a trivial script.. import numpy print ‘hello world’ the built executable gives this stack trace.. No scipy-style subpackage 'testing' found in /apps/work/are/trunk/exe/foo?2383260:/work/deva/temp\ /_MEI2281:/apps/work/are/trunk/exe/buildfoo/out1.pyz.
Ignoring. No scipy-style subpackage 'core' found in
/apps/work/are/trunk/exe/foo?2383260:/work/deva/temp/_M\ EI2281:/apps/work/are/trunk/exe/buildfoo/out1.pyz. Ignoring. No scipy-style subpackage 'lib' found in
/apps/work/are/trunk/exe/foo?2383260:/work/deva/temp/_ME\ I2281:/apps/work/are/trunk/exe/buildfoo/out1.pyz. Ignoring. No scipy-style subpackage 'linalg' found in
/apps/work/are/trunk/exe/foo?2383260:/work/deva/temp/\ _MEI2281:/apps/work/are/trunk/exe/buildfoo/out1.pyz.
Ignoring. No scipy-style subpackage 'dft' found in
/apps/work/are/trunk/exe/foo?2383260:/work/deva/temp/_ME\ I2281:/apps/work/are/trunk/exe/buildfoo/out1.pyz. Ignoring. No scipy-style subpackage 'random' found in
/apps/work/are/trunk/exe/foo?2383260:/work/deva/temp/\ _MEI2281:/apps/work/are/trunk/exe/buildfoo/out1.pyz.
Ignoring. No scipy-style subpackage 'f2py' found in
/apps/work/are/trunk/exe/foo?2383260:/work/deva/temp/_M\ EI2281:/apps/work/are/trunk/exe/buildfoo/out1.pyz. Ignoring. Traceback (most recent call last): File "<string>", line 1, in ? File
"/work/deva/aif/pyinstaller_1.2/iu.py", line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File "/work/deva/aif/pyinstaller_1.2/iu.py",
line 398, in doimport exec co in mod.__dict__ File
"/apps/work/are/trunk/exe/buildfoo/out1.pyz/numpy", line 44, in ? File
"/apps/work/are/trunk/exe/buildfoo/out1.pyz/numpy._import_tools",
line 320, in get_pkgdocs File
"/apps/work/are/trunk/exe/buildfoo/out1.pyz/numpy._import_tools",
line 283, in _format_tit\ les ValueError: max() arg is an empty sequence Thanks, Stefan This email and any files transmitted with it are confidential, proprietary and intended solely for the individual or entity to whom they are addressed. If you have received this email in error please delete it immediately.This email and any files transmitted with it are confidential, proprietary and intended solely for the individual or entity to whom they are addressed. If you have received this email in error please delete it immediately. |
_______________________________________________ PyInstaller mailing list [email protected] http://lists.hpcf.upr.edu/mailman/listinfo/pyinstaller
