3

I am using buildout to create a local python environment, and then using the local python to create my app with py2app. But, when I go into the .app file, specifically into Contents/MacOS/, there is just a shortcut to the system python. I want py2app to somehow take the local python with it so that it only depends on itself, not on the system python.

So my question is: How can I fix this so that py2app will bundle my custom local version of python2.7 so that my app will be totally standalone, regardless of the local python version?

Please let me know if more information would be helpful.

My setup.py

from setuptools import setup APP = ['main.py'] DATA_FILES = ['src/icon.xib'] OPTIONS = { 'argv_emulation': True, 'packages': [ 'requests' ], 'iconfile':'src/myApp.icns', 'plist': {'CFBundleShortVersionString':'0.1.0', 'LSUIElement': True } } setup( name='myApp', package_dir = {'':'src'}, app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) 
7
  • stackoverflow.com/questions/10184974/… is a bit similar. It might get you somewhere. Commented Jul 11, 2013 at 15:42
  • right, i saw that before. Is what I'm doing (using a local python from buildout) different than what is described in the solution there? I'm not creating the app with the system python, i'm using my local python Commented Jul 11, 2013 at 15:44
  • Hmm...according to the py2app website, a non-standalone build should only happen if the -s option is enabled. Commented Jul 11, 2013 at 15:58
  • 1
    Well, it seems that way. According to some research I did, some py2app builds accidently enable that option. Verify you have the latest version. Also, are you absolutely sure you are calling the local Python from the terminal? Can you try not using virtualenv? Commented Jul 11, 2013 at 16:05
  • 1
    It seems to be...can you modify setup.py to import sys and print sys.executable? And, can you try without virtualenv? Commented Jul 11, 2013 at 17:29

1 Answer 1

1

Py2app will not include system files, such as the python installation in /System/Library/Frameworks, in your application bundle.

To create a bundle that also includes Python you need to install a separate version of Python (and all libraries that you use).

However, note that the app created with the system version of Python should work properly on machines with the same release of OSX, or a later release.

Sign up to request clarification or add additional context in comments.

2 Comments

I am using zc.buildout to set up my environment, and it seems that the local python is not a standard python. When I use py2app with it, it creates the semi-standalone app. If I make a virtualenv with a standard python however, I get the desired result. Is there a way you know of to get buildout to download/use the correct python for py2app?
I don't use buildout myself. If py2app creates a semi-standalone build with it, buildout either creates a static build of python (no shared library with the python interpreter), or uses /usr/bin/python instead of the one you want to use.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.