4

So I am trying to build a Mac osx app from python using PyQt4 and either py2app or pyinstaller. Both these scripts build apps that work fine on my build machine ( running mavericks 10.9.5 ) but when I try to use it on another machine they both crash with an EXC_BAD_INSTRUCTION and then list QT libraries.

I think that maybe my apps are not including the Qt libraries in the build. My setup 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'],
)
Luís Cruz
  • 14,780
  • 16
  • 68
  • 100
Andy MGF
  • 133
  • 1
  • 7

3 Answers3

0

I actually managed to fix this issue by installing MacPorts and installing python27. I couldn't build standalone application bundles with the system python in OS X using py2app. So in order to build standalone PyQt apps, I setup Python, PyQt, etc., under MacPorts.

Andy MGF
  • 133
  • 1
  • 7
0

I solved this problem. are you using the python's brew environment? if so, try to build it on the default python environment, not the brew.

third9
  • 464
  • 5
  • 10
0

I had the same issue - my setup was python3 and pyqt4, both installed via brew. First I completely removed brew:

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, the pyqt4 lib is installed by

sudo port install py34-pyqt4

This will automatically install python3 and all required dependencies. Note that macports installs python (and all other stuff) to /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 a packaged app on other systems. I am not 100% sure what the underlying problem really is, but in my case I suspect that sip via brew ran some optimizations for my systems that caused incompatibilities...

ndbd
  • 2,417
  • 3
  • 23
  • 32
  • ... and brew won't fix it ( https://github.com/Homebrew/homebrew/issues/38814#issuecomment-94280066 ) - I find their attitude quite ... – ndbd Apr 19 '15 at 18:19
  • I am experiencing the same issue with pyqt5. But it is weird that for instance if I compile with py2app in a Macbook pro 2011 that I own, and then move it to other computers, it works. But if I compile in my other Macbook pro 2015 and then move the older models it does not work... Maybe I should try ports... – muammar May 19 '16 at 21:23