py2app problems, using Enthought Python Distribution
Hi, I am trying to use py2app to build a standalone for a python script that uses the matplotlib, numpy and scipy modules, using an up to date version of the Enthoought Python Distribution (EPD) with Python 2.73, 32-bit. The setuptools and distribute modules included with EPD are both version 0.6.49, but I have manually updated setutptools to 2.2 and distribute to 0.7.3.
This is being done on a Mac with OS X Mountain Lion (10.8.5).
With the alias option for py2app, the application builds and runs fine, but when I try to build a standd-alone application, I have run into several problems, some of which I think that I fixed myself, but the final app fails. The problems I have run into, and my attempted solutions are described below.
This py2app build hsangs with
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/sympy/mpmath/libmp/exec_py3.py", line 1 exec_ = exec ^ SyntaxError: invalid syntax
But, can get past this with > python setup.py py2app --exclude sympy
- Then it hangs with:
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/py2app-0.8-py2.7.egg/py2app/build_app.py", line 1319, in copy_python_framework fwkfiles.append( NameError: global name 'fwkfiles' is not defined
I tracked this down to:
fmwkfiles = [ os.path.basename(info['name']), 'Resources/Info.plist', 'include/%s/pyconfig.h'%(includedir), ] if '_sysconfigdata' not in sys.modules: fwkfiles.append( 'lib/%s/%s/Makefile'%(pydir, configdir) )
in build_app.py, where it looks like fwkfiles should be fmwkfiles. Changing "fwkfiles.append" to "fmwkfiles.append" allows the build to continue.
Then, it hangs on:
line 49, in locate loader=loader.filename) TypeError: dyld_find() got an unexpected keyword argument 'loader'
The app builds using --debug-skip-macholib option but, the application fails with:
2/27/14 1:38:29.355 PM revinhib: A Python runtime not could be located. You may need to install a framework build of Python, or edit the PyRuntimeLocations array in this application's Info.plist file.
I tracked the problem with macholib back to the definition of dyld_find() in dyld.py:
def dyld_find(name, executable_path=None, env=None, loader_path=None):
I changed line 49 in macOGraph from loader=loader.filename)
Now, py2app runs and generates an app, but
- The built app fails with:
Traceback (most recent call last): File "/Users/davidg/Dropbox/work-db/programmingProjects/revInhibFit/dist/revinhib.app/Contents/Resources/boot.py", line 393, in <module> _run() File "/Users/davidg/Dropbox/work-db/programmingProjects/revInhibFit/dist/revinhib.app/Contents/Resources/boot.py", line 336, in _run exec(compile(source, path, 'exec'), globals(), globals()) File "/Users/davidg/Dropbox/work-db/programmingProjects/revInhibFit/dist/revinhib.app/Contents/Resources/revinhib.py", line 5, in <module> import numpy as np File "/Users/davidg/Dropbox/work-db/programmingProjects/revInhibFit/dist/revinhib.app/Contents/Resources/lib/python2.7/numpy/init.py", line 168, in <module> from . import add_newdocs File "/Users/davidg/Dropbox/work-db/programmingProjects/revInhibFit/dist/revinhib.app/Contents/Resources/lib/python2.7/numpy/add_newdocs.py", line 13, in <module> from numpy.lib import add_newdoc File "/Users/davidg/Dropbox/work-db/programmingProjects/revInhibFit/dist/revinhib.app/Contents/Resources/lib/python2.7/numpy/lib/init.py", line 18, in <module> from .polynomial import File "/Users/davidg/Dropbox/work-db/programmingProjects/revInhibFit/dist/revinhib.app/Contents/Resources/lib/python2.7/numpy/lib/polynomial.py", line 19, in <module> from numpy.linalg import eigvals, lstsq, inv File "/Users/davidg/Dropbox/work-db/programmingProjects/revInhibFit/dist/revinhib.app/Contents/Resources/lib/python2.7/numpy/linalg/init.py", line 50, in <module> from .linalg import File "/Users/davidg/Dropbox/work-db/programmingProjects/revInhibFit/dist/revinhib.app/Contents/Resources/lib/python2.7/numpy/linalg/linalg.py", line 29, in <module> from numpy.linalg import lapack_lite, _umath_linalg ImportError: dlopen(/Users/davidg/Dropbox/work-db/programmingProjects/revInhibFit/dist/revinhib.app/Contents/Resources/lib/python2.7/numpy/linalg/lapack_lite.so, 2): Library not loaded: @rpath/lib/libmkl_intel.dylib Referenced from: /Users/davidg/Dropbox/work-db/programmingProjects/revInhibFit/dist/revinhib.app/Contents/Resources/lib/python2.7/numpy/linalg/lapack_lite.so Reason: image not found 2014-02-27 14:17:34.103 revinhib[36339:303] revinhib Error
Any help would be greatly appreciated!