I am trying to create a standalone Mac GUI app.
I used wxPython (wxpython-phoenix 3.0.3) to create the GUI.
I am trying to use py2app (0.14) to create a standalone app that can be used on a different machine not requiring a python installation.
The wxPython works fine by itself on the machine where it was created (MacOS Sierra, virtual environment in miniconda python).
I am able to compile the app using py2app, but the app does not work. When I run it from the command line, I get the following error:
Traceback (most recent call last):
File "/repos/ct/dist/CtAnnotator.app/Contents/Resources/__boot__.py", line 386, in <module>
_run()
File "/repos/ct/dist/CtAnnotator.app/Contents/Resources/__boot__.py", line 370, in _run
exec(compile(source, path, 'exec'), globals(), globals())
File "/repos/ct/dist/CtAnnotator.app/Contents/Resources/CtAnnotator.py", line 2, in <module>
import wx
File "/repos/ct/dist/CtAnnotator.app/Contents/Resources/lib/python2.7/wx/__init__.py", line 17, in <module>
from wx.core import *
File "/repos/ct/dist/CtAnnotator.app/Contents/Resources/lib/python2.7/wx/core.py", line 12, in <module>
from ._core import *
ImportError: dlopen(/repos/ct/dist/CtAnnotator.app/Contents/Resources/lib/python2.7/wx/_core.so, 2): Symbol not found: _iconv
Referenced from: /repos/ct/dist/CtAnnotator.app/Contents/MacOS/../Resources/lib/python2.7/wx/libwx_baseu-3.0.0.3.0.dylib
Expected in: /repos/ct/dist/CtAnnotator.app/Contents/MacOS/../Frameworks/libiconv.2.dylib
in /repos/ct/dist/CtAnnotator.app/Contents/MacOS/../Resources/lib/python2.7/wx/libwx_baseu-3.0.0.3.0.dylib
2017-07-14 00:46:55.453 CtAnnotator[38476:1598471] CtAnnotator Error
Here's my build python script:
#!/usr/bin/env python
"""
build_CtAnnotator.py - script for building CtAnnotator
Usage:
% python build_CtAnnotator.py py2app
"""
from setuptools import setup
import sys
# from distutils.core import setup
sys.setrecursionlimit(20000)
APP = ['CtAnnotator.py']
PACKAGES = ['wx', 'os', 'dicom', 'operator', 'cv2', 'numpy', 'cPickle']
OPTIONS = {'argv_emulation': True,
'plist': {'PyRuntimeLocations': ['/opt/localdepth/localdepth/localdepth/localdepth/localdepth/localdepth/miniconda2/envs/app-env/lib/libpython2.7.dylib']},
'packages': ['wx'],
}
DATA_FILES = []
setup(app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
The reason for the deep miniconda installation is to avoid the "Mach-O header is too large to relocate in" error.
Can someone help me figure out how to solve this problem?
Thanks!