Issues

Issue #36 new

py2app fails to build a working executable on snow leopard with python2.6 stock install

onidaito avataronidaito created an issue

Extremely simple python script built as a distributed application, fails to run with the error

26/02/2012 11:24:49 [0x0-0x3c03c].org.pythonmac.unspecified.imagestopdf[502] distutils.errors.DistutilsPlatformError: invalid Python installation: unable to open /usr/include/python2.6/pyconfig.h (No such file or directory)

This occurs with both the easy_install version and the current bitbucket version built from source. I suspect a distutils problem with Apple's stock install on snowleopard

Comments (14)

  1. Ronald Oussoren

    I haven't had time to look into this yet, hopefully that will happen this week.

    I'm running 10.7 myself (but have a 10.6 VM that I can use to develop a fix), does /usr/include/python2.6/pyconfig.h exist on 10.6? It does exist on 10.7, but there are differences in the way python is packaged in the various OSX releases.

  2. Ronald Oussoren

    Could you create a sample project that demonstrates the problem? I've tested in a VM running 10.6.3 and that seems to work fine for both the "simple" and "hello_tk" examples in the py2app source tree.

    BTW. Are you running the output of py2app on a 10.6 machine or on another OSX release?

  3. Nathan Salomonis

    I have confirmed this issue when building a py2app application from Mac OS X 10.6 and running on 10.8.

    For me, the error comes when my app is trying to import matplotlib's mpl_toolkits module which calls:

    /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/sysconfig.py and results in the above error.

    While the directory /usr/ exists on 10.8, I cannot find a default "include" and "include/python2.6/pyconfig.h" directory structure. This is a newly purchased Mac. If I create this directory on 10.8 and add pyconfig.h to it, my py2app frozen application works fine (does not have issues performing matplotlib or igraph visualization).

    In my py2app pacakge directory, under "Contents/Resources" there is a sym-link to the directory "include" which points to: /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h

    Hence, the needed file is being referenced on the destination machine running the program but the application is still pointing to the 10.6 default pyconfig.h location and not using the pyconfig.h location in the app's sym-linked include folder.

    I also tried specifically adding the py2app resources option which now points to the file: /usr/include/python2.6/pyconfig.h

    on the 10.6 compiling machine and which includes the pyconfig.h file in the py2app archive in the resources directory, but still results in the above error.

    Any work around suggestions would be much appreciated.

  4. Nathan Salomonis

    As a follow up, I am using the native python 2.6 distributed with my Mac OS 10.6 machine. I was using a python.org version of python but had to revert in order to get the igraph library to install and work (needed for my application along with matplotlib and others). I have seen that using py2app with the native python will not allow the py2app to be completely standalone, hence depending on the end-user's local libraries, which seems to be causing the problem here. Is there a way to force py2app to include these dependencies without moving to the python.org version?

  5. Ronald Oussoren

    Py2app will only create semi standalone applications when using the system installation of Python. This is primarily done to avoid shipping parts of the system, which could be problematic (although IANAL)

  6. Nathan Salomonis

    Would including certain framework libraries potentially address the issue I am facing with native python 2.6? Basically the problem is just that it is referencing the wrong pyconfig.h location on the local machine.

  7. blaxter

    The issue is that /usr/include/python directories are only created once you install xcode package (not 100% sure, but either that or another devel packages). A clean mac (and all macs of no-developers users) will have this pyconfig.h file only under /System/Library/Frameworks/Python.framework/Versions/2.X/include/pyconfig.h. The weird stuff is that Contents/Resources/include symlink is properly generated, but the pyconfig.h of that directory is not used and the app is trying to use it from /usr/include/python/* instead.

  8. Luke McCarthy

    The problem is that the symlink to python in Foobar.app/Contents/MacOS is pointing to /usr/bin/python. If you run the build with:

    /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python setup.py py2app

    Then it will create a symlink to the Python in /System and it will be able to find its pyconfig.h in there.

    Maybe it would be better if py2app would include a copy of the whole Python system like py2exe and cx_Freeze do so that we don't have to rely on the system installation?

  9. Ronald Oussoren

    Py2app won't copy files from /usr/lib or /System into your application, those are part of the OS and shipping them to someone else would be dodgy license wise. There's also the risk of accidently including the entire OS on your app :-)

    To create a fully standalone application bundle you need to use a non-system install of Python (such as provided by one of the installers on www.python.org)

  10. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.