Error with standalone wxpython app created with py2app

226 views
Skip to first unread message

Oksana Meledin

unread,
Jul 14, 2017, 11:21:05 AM7/14/17
to wxPython-users
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!

Igor Korot

unread,
Jul 14, 2017, 11:47:16 AM7/14/17
to wxpytho...@googlegroups.com
Hi, Oksana,

On Fri, Jul 14, 2017 at 4:13 AM, Oksana Meledin <oksana...@gmail.com> wrote:
> 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:

Are you trying to run the binary in the same environment or a different machine?

Thank you.
> --
> You received this message because you are subscribed to the Google Groups
> "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to wxpython-user...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Igor Korot

unread,
Jul 14, 2017, 1:40:06 PM7/14/17
to wxpytho...@googlegroups.com

Oksana Meledin

unread,
Jul 15, 2017, 4:12:20 AM7/15/17
to wxPython-users
Hi Igor,

Thanks for taking a look at my issue.

I'm trying to run it on the same machine for now. The eventual goal is to run it on a different mac without a python development environment.

I did take a look at  https://github.com/openai/universe/issues/139. The issue is similar to mine but not the same. I am not trying to "import universe". Rather I am doing "import wx".

David Hughes

unread,
Jul 15, 2017, 5:51:18 AM7/15/17
to wxPython-users


On Friday, July 14, 2017 at 4:21:05 PM UTC+1, Oksana Meledin wrote:
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:


As your app works OK with wx Python itself, you may get more help with the py2app part of it from the pythonmac-SIG list which often has discussions about py2app and its development.

Pythonmac-SIG maillist  -  Python...@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig

--
Regards
David Hughes
Forestfield Software
 
Reply all
Reply to author
Forward
0 new messages