1. Ronald Oussoren
  2. py2app
  3. Issues

Issues

Issue #57 wontfix

py2app has issues determining python version and framework name

Justin Israel
created an issue

While testing a build using Maya's bundled python2.6 interpreter, I found that it would constantly fail with two different issues:

  1. The python version would not be detected and result in a "pythonNone" directory name
  2. The framework location would be located at the incorrect filesystem depth, and would crash when attempting to copy header files from "include"

Command:
$ mayapy setup.py py2app

Output:

... creating /Users/justin/temp/struct/dist/test.app/Contents/Frameworks/Python.framework/lib/pythonNone creating /Users/justin/temp/struct/dist/test.app/Contents/Frameworks/Python.framework/lib/pythonNone/config copying /Applications/Autodesk/maya2012/Maya.app/Contents/bin/../Frameworks/Python.framework/Python -> /Users/justin/temp/struct/dist/test.app/Contents/Frameworks/Python.framework copying /Applications/Autodesk/maya2012/Maya.app/Contents/bin/../Frameworks/Python.framework/Resources/Info.plist -> /Users/justin/temp/struct/dist/test.app/Contents/Frameworks/Python.framework/Resources error: can't copy '/Applications/Autodesk/maya2012/Maya.app/Contents/bin/../Frameworks/Python.framework/include/python2.6/pyconfig.h': doesn't exist or not a regular file

The fix I have found to work is to add another fallback condition to copy_python_framework() when the version or include dir are not properly found.

Proposed patch attached, along with my sample setup,py that I am using.

Comments (16)

  1. Ronald Oussoren repo owner

    What's the directory structure of the Python framework embedded in Maya? It there a Version directory in there? I'd like to know this to be able to document, and possibly test, the changes in your patch.

    BTW. Do you use the --semi-standalone option of py2app? That option won't copy the Python framework into the generated bundle.

    Could you check if the problem is still present in the tip of the tree (you'll have to install altgraph, modulegraph, macholib and py2app from my bitbuck repositories)?

    The problem is probably still present, in particular the patch fragment that adjusts 'indir', but I'd like to know that for sure before applying that part of the patch.

  2. Justin Israel reporter

    I have attached the directory structure of maya's python framework.

    I just tried semi_standalone mode and I still get the same issue unfortunately:

    error: can't copy '/Applications/Autodesk/maya2012/Maya.app/Contents/bin/../Frameworks/Python.framework/include/python2.6/pyconfig.h': doesn't exist or not a regular file

    I have not yet tried the tip install. Will report back.

  3. Justin Israel reporter

    I've just tried using all of the tip installations, in a virtualenv. It seems that the py2app 0.7 version now requires python2.7+ (2.7 only features of subprocess)? Maya is bundled with python2.6

    ` $ mayapy setup.py py2app

    ...

    File "/Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 1954, in load File "/Users/justin/Desktop/standalone_app/env/lib/python2.6/site-packages/py2app/build_app.py", line 43, in <module> from py2app.create_appbundle import create_appbundle File "/Users/justin/Desktop/standalone_app/env/lib/python2.6/site-packages/py2app/create_appbundle.py", line 8, in <module> from py2app.util import makedirs, mergecopy, mergetree, skipscm, make_exec File "/Users/justin/Desktop/standalone_app/env/lib/python2.6/site-packages/py2app/util.py", line 585, in <module> MOMC=subprocess.check_output(['/usr/bin/xcrun', '-find', 'momc'])[:-1] AttributeError: 'module' object has no attribute 'check_output' `

  4. Ronald Oussoren repo owner

    Changeset 'f56af430eec0' contains the part of your patch that adjusts 'indir', which should be the only bit of the patch that is needed with the current tree.

    Some more questions: What is it the output of "tool -vL" for the mayapy executable? What is the value sys.prefix? * Could you patch copy_python_framework in build_app.py to print info?

  5. Justin Israel reporter

    mayapy is actually just a shell script containing specific environment variables, and then launches the bundled python interpreter:

    mayapy

    #!/bin/sh

    path=dirname $0 pythonhome=$path/../Frameworks/Python.framework/Versions/Current export PYTHONHOME=$pythonhome export DYLD_LIBRARY_PATH=$path/../MacOS:$DYLD_LIBRARY_PATH export DYLD_FRAMEWORK_PATH=$path/../Frameworks:$DYLD_FRAMEWORK_PATH export MAYA_LOCATION=$path/.. exec $pythonhome/Resources/Python.app/Contents/MacOS/Python "$@"

    Did you mean the output of otool?

    otool

    $ otool -vL /Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/Resources/Python.app/Contents/MacOS/Python

    /Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/Resources/Python.app/Contents/MacOS/Python: /Users/grebelc/Library/Frameworks--enable-unicode=ucs4/Python.framework/Versions/2.6/Python (compatibility version 2.6.0, current version 2.6.0) time stamp 2 Wed Dec 31 16:00:02 1969 /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4) time stamp 2 Wed Dec 31 16:00:02 1969 /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) time stamp 2 Wed Dec 31 16:00:02 1969

    sys.prefix

    And sys.prefix is:
    /Applications/Autodesk/maya2012/Maya.app/Contents/bin/../Frameworks/Python.framework/Versions/Current

  6. Ronald Oussoren repo owner

    Yikes. Setting DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH is evil, but that's nothing you can fix :-)

    Could you check if the current tip works? The functionality of "py2app_ver_name_fix.patch" should be present in that version.

  7. Justin Israel reporter

    Just tested again using all tip checkouts...

    Using my standard python2.6 and semi_standalone:True has been the only way so far to get a working build. I also had to include site_packages:True and use_pythonpath:True, and then pass a set of environment variables over to plist: {'LSEnvironment: env'} so that it would launch and completely find the external Maya python framework and mimic the startup script contents of mayapy

    The original problem still persists when trying to do a complete standalone build. And I also discovered two new things...

    1) The tip py2app sip recipe now seems to want to copy over the qt.conf, but it is not included in the py2app/recipes directory. Copying over one of mine seems to get past that error

    2) The original problem of detecting the python framework seems to also exists for virtualenv, which is what I have been using to test different configurations of the py2app version and dependencies...

    My virtualenv is here: /Users/justin/Desktop/standalone_app/env

    py2app fails with this: error: can't copy '/Users/justin/Library/Frameworks/Python.framework/Versions/Current/include/python2.6/pyconfig.h': doesn't exist or not a regular file

    As it stands, building directly against Maya's python framework using mayapy and also using a normal python from within virtualenv, produces the same failed results.

    Thanks by the way for working this out so far.

  8. Ronald Oussoren repo owner

    The qt.conf issue was stupid, I had forgotten to add the new data file to setup.py and therefore it didn't get installed.

    That should be fixed now.

    What version of virtualenv do you use? I've had other reports about problems with virtualenv but haven't been able to reproduce them yet.

  9. Ronald Oussoren repo owner
    • edited description
    • marked as minor

    Lowering the priority because this affects fairly non-standard usecase.

    Also: it is unlikely that I'll fix this issue because I cannot reproduce the issue and don't have access to Maya (there is a demo for Maya, but that demo is not free)

  10. Log in to comment