J Jones
J Jones

Reputation: 3190

py2app failing with Anaconda Python 3

I am trying to build my wxPython application with Python 3 using py2app. Before I updated my code to Python 3, I was able to do this successfully in Python 2.

After fixing a few initial problems (had to sys.setrecursionlimit(2000) and downgrade to Python 3.5), I got stuck here:

Traceback (most recent call last):
  File "setup_pmag_gui.py", line 23, in <module>
    setup_requires=['py2app'],
  File "/Users/****/anaconda/lib/python3.5/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Users/****/anaconda/lib/python3.5/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/Users/****/anaconda/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/Users/****/my_project/.eggs/py2app-0.13-py3.5.egg/py2app/build_app.py", line 757, in run
    self._run()
  File "/Users/****/my_project/.eggs/py2app-0.13-py3.5.egg/py2app/build_app.py", line 967, in _run
    self.run_normal()
  File "/Users/****/my_project/.eggs/py2app-0.13-py3.5.egg/py2app/build_app.py", line 1075, in run_normal
    self.create_binaries(py_files, pkgdirs, extensions, loader_files)
  File "/Users/****/my_project/.eggs/py2app-0.13-py3.5.egg/py2app/build_app.py", line 1385, in create_binaries
    mm.mm.run_file(runtime)
  File "/Users/****/my_project/.eggs/macholib-1.8-py3.5.egg/macholib/MachOGraph.py", line 83, in run_file
ValueError: '/Users/****/anaconda/lib/libpython3.5.dylib' does not exist

/Users/****/anaconda/lib/libpython3.5m.dylib does exist, though. Is there a way to tell MachOGraph how to find this?

I am on OS X 10.12.4, using Anaconda Python 3.5. My version of py2app is 0.13.

This is what my setup.py file looks like:

from setuptools import setup
import sys
import os
directory = os.getcwd()
sys.setrecursionlimit(3000)

APP = ['programs/pmag_gui.py']
DATA_FILES = [('', ['dialogs/help_files', 'pmagpy/data_model', 'programs/images'])]
OPTIONS = {'argv_emulation': False,
       'iconfile': os.path.join(directory, 'programs', 'images', 'text_x_xslfo.icns')}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],

)

After reading the Tweaking your Info.plist py2app documentation, and this question, I tried adding to OPTIONS:

'plist': dict(PyRuntimeLocations=['/Users/****/anaconda/lib/libpython3.5m.dylib'])

But I get the same exact error message as before.

Any suggestions on how to solve this, or what documentation to look at?

Upvotes: 1

Views: 1207

Answers (1)

Babak Hashemi
Babak Hashemi

Reputation: 327

I had same problem with miniconda and py2app. I could fix it by creating a symlink!

 ln -s /path/to/lib/libpython3.5m.dylib /path/to/lib/libpython3.5.dylib

Upvotes: 4

Related Questions