(PyQt4, py2app and pyinstaller crash when moving .app to another machine
So I am trying to build an osx app for Mac using python using PyQt4 and py2app or pyinstaller. Both of these scripts create apps that work fine on my build machine (mavericks 10.9.5 works), but when I try to use it on another machine, they both fail with EXC_BAD_INSTRUCTION
and then list the QT libraries.
I think maybe my applications are not including the Qt libraries in the assembly. My settings file for py2app looks like this:
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
from setuptools import setup
APP = ['FudgeTestpy.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui'],
'excludes': ['PyQt4.QtDesigner', 'PyQt4.QtNetwork', 'PyQt4.QtOpenGL', 'PyQt4.QtScript',
'PyQt4.QtSql', 'PyQt4.QtTest', 'PyQt4.QtWebKit', 'PyQt4.QtXml', 'PyQt4.phonon']}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
source to share
I had the same problem - my setup was python3 and pyqt4, both installed via brew. First I uninstalled brew completely:
cd `brew --prefix`
rm -rf Cellar
brew prune
rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew
rm -rf ~/Library/Caches/Homebrew
(These steps are taken from here ) After installing macports, pyqt4 lib is installed
sudo port install py34-pyqt4
This will automatically install python3 and all required dependencies. Note that macports installs python (and everything else) in / opt / local / bin. There is also a package in macports for py2app, so there is no need to use pip:
sudo port install py34-py2app
Now there is no problem running the packaged application on other systems. I'm not 100% sure what the underlying problem is, but in my case I suspect sip via brew did some optimizations for my systems that caused incompatibilities ...
source to share