Comments you submit will be routed for moderation. If you have an account, please log in first.

Ticket #152 (new defect)

Opened 7 months ago

Last modified 4 months ago

pyinstaller onefile fails to bundle Python framework shared lib on osx

Reported by: marvingreenberg Owned by: giovannibajo
Priority: highest Milestone: PyInstaller 1.4.1
Component: PyInstaller Version: PyInstaller 1.4
Severity: blocker Keywords: osx
Cc:

Description

The loader expects to load the python framework library sys.exec_prefix/Python from the _MEI temp dir, but the current Build.py does not bundle it.

The error is below, ".Python" is a fallback apparently for some other osx issue. stdout: Error loading Python lib '/tmp/_MEIN4IBw9/.Python': dlopen(/tmp/_MEIN4IBw9/.Python, 10): image not found

Patch attached to add it the Python shared library to the onefile. An alternative might be for the loader to look in "standard places" for the osx shared library, but bundling it provides better isolation from any incompatibility for an existing image with OSX updates.

Attachments

pyinstaller.patch Download (0.7 KB) - added by marvingreenberg 7 months ago.

Change History

Changed 7 months ago by marvingreenberg

  Changed 6 months ago by chriswayg

The patch works well with Pyqt, thanks. Its apparently needed not just for --onefile, but also when using the default --onedir option on OS-X.

follow-ups: ↓ 3 ↓ 5   Changed 6 months ago by giovannibajo

Hi, thank you for your patch!

The correct fix should be done in Configure.py (find_EXE_dependencies). Can you please debug why that function doesn't correctly find the Python framework?

in reply to: ↑ 2   Changed 5 months ago by antonio.valentino

Replying to giovannibajo:

Hi, thank you for your patch! The correct fix should be done in Configure.py (find_EXE_dependencies). Can you please debug why that function doesn't correctly find the Python framework?

Hi Giovanni, if my understanding is correct /usr/bin/python should depend on /System/Library/Frameworks/Python.framework/Versions/2.6/Python but

$ otool -L /usr/bin/python 
/usr/bin/python:
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.19.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1)

so the python lib is not listed in dependencies.

Am I on the right way?

  Changed 5 months ago by giovannibajo

  • version set to PyInstaller 1.4
  • milestone set to PyInstaller 1.4.1

Yes. The next step is trying to understand whether the Python library is dynamically loaded under Mac OSX (through dlopen()) or it relies on some dependencies which is not resolved by otool.

In the former case, you probably need to special case find_EXE_dependencies under Mac (trying to not to break alternative builds like MacPorts?, etc.). In the latter case, you need to enhance bindepend.py so that it can fully track binary dependencies even beyond the current otool-based implementation.

in reply to: ↑ 2   Changed 4 months ago by _hh

Couldn't you please just apply the patch, so pyinstaller is working on Mac OS X in the meantime of you working on the 'correct' fix?

Add/Change #152 (pyinstaller onefile fails to bundle Python framework shared lib on osx)

Author


E-mail address and user name can be saved in the Preferences.


Action
as new
 
Note: See TracTickets for help on using tickets.