Issues

Issue #89 new

py2app issues with PyQt4

Thomas Crawford
created an issue

Hi,

I am at a loss as to how to proceed. I have tried every combination of setup.py file I can find on the web. I have found all the information about making empty "qt.conf" files and the whatnot, but I am stuck.

If I start my application from the terminal: Zymurgy.app/Contents/MacOS/Zymurgy

I get the following error: Traceback (most recent call last): File "/Users/tommyc/Documents/Zymurgy/Zymurgy_trunk/dist/Zymurgy.app/Contents/Resources/boot.py", line 43, in <module> _run() File "/Users/tommyc/Documents/Zymurgy/Zymurgy_trunk/dist/Zymurgy.app/Contents/Resources/boot.py", line 38, in _run exec(compile(source, path, 'exec'), globals(), globals()) File "/Users/tommyc/Documents/Zymurgy/Zymurgy_trunk/dist/Zymurgy.app/Contents/Resources/zymurgy.py", line 20, in <module> from PyQt4.QtGui import * ImportError: No module named QtGui

I have tried the following for setup.py files:

APP = ['zymurgy.py']
OPTIONS = {'argv_emulation': False}

setup(
    app=APP,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
python

or

from setuptools import setup

APP = ['zymurgy.py']

OPTIONS = {'includes': ['sip', 'PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui', 'matplotlib', 'numpy', 'scipy', 'pandas', 'sqlite3'],  #],
           'argv_emulation': False}


setup(
        name = "Zymurgy",
        version="1.0.0 beta",  
        app=APP,
        options={'py2app': OPTIONS},
        setup_requires=['py2app'],
)

I am using Python 3.2.3 installed via Homebrew PyQt4 is installed and compiled from source

thanks for any help you could give,

Tommy

Comments (10)

  1. Ronald Oussoren repo owner

    Could you attach the output of py2app, that might help explain what's going on?

    Also: are you sure you are using the copy of python you think you are using?

    And finally: there is a Qt example in the py2app source archive, does that work?

  2. Thomas Crawford reporter

    One strange thing I am seeing now that I piped the output to a file is some syntax errors:

    tommyc  $python3 setup.py py2app >py2appoutput.txt
      File "PyQt4/QtCore.pyc", line 6
        print path
                 ^
    SyntaxError: invalid syntax
    
      File "PyQt4/QtGui.pyc", line 6
        print path
                 ^
    SyntaxError: invalid syntax
    
      File "PyQt4/QtSvg.pyc", line 6
        print path
                 ^
    SyntaxError: invalid syntax
    
      File "pandas/_parser.pyc", line 6
        print path
                 ^
    SyntaxError: invalid syntax
    
      File "pandas/_sparse.pyc", line 6
        print path
                 ^
    SyntaxError: invalid syntax
    
      File "pandas/algos.pyc", line 6
        print path
                 ^
    SyntaxError: invalid syntax
    
      File "pandas/hashtable.pyc", line 6
        print path
                 ^
    SyntaxError: invalid syntax
    
      File "pandas/index.pyc", line 6
        print path
                 ^
    SyntaxError: invalid syntax
    
      File "pandas/lib.pyc", line 6
        print path
                 ^
    SyntaxError: invalid syntax
    
      File "pandas/tslib.pyc", line 6
        print path
                 ^
    SyntaxError: invalid syntax
    
      File "statsmodels/tsa/kalmanf/kalman_loglike.pyc", line 6
        print path
                 ^
    SyntaxError: invalid syntax
    

    I reinstalled Qt 4.8.4 and PyQt 4.9.6, same error. Not sure what is going on with statsmodels

  3. Thomas Crawford reporter

    I tried the example code in the py2app source, it looks the same.

    I also tried with argv_emulation both true and false, as well as using the --no-strip option

  4. Ronald Oussoren repo owner

    Sorry about the delay, I got hit by the flu season :-(

    The syntax error appears to be due to the use of python 2 code (print statement instead of a print function). That might indicate that py2app copies files from the wrong location, but the py2app output looks correct at first glance.

    Does "python setup.py py2app -A" result in a workin app bundle? The "-A" flag creates a bundle with symlinks to the sources (and resources).

  5. Thomas Crawford reporter
    tommyc  $python3 setup.py py2app -A
    running py2app
    creating /Users/tommyc/Documents/Zymurgy/Zymurgy_trunk/build
    creating /Users/tommyc/Documents/Zymurgy/Zymurgy_trunk/build/bdist.macosx-10.8-x86_64
    creating /Users/tommyc/Documents/Zymurgy/Zymurgy_trunk/build/bdist.macosx-10.8-x86_64/python3.2-standalone
    creating /Users/tommyc/Documents/Zymurgy/Zymurgy_trunk/build/bdist.macosx-10.8-x86_64/python3.2-standalone/app
    creating /Users/tommyc/Documents/Zymurgy/Zymurgy_trunk/build/bdist.macosx-10.8-x86_64/python3.2-standalone/app/collect
    creating /Users/tommyc/Documents/Zymurgy/Zymurgy_trunk/build/bdist.macosx-10.8-x86_64/python3.2-standalone/app/temp
    creating /Users/tommyc/Documents/Zymurgy/Zymurgy_trunk/dist
    creating build/bdist.macosx-10.8-x86_64/python3.2-standalone/app/lib-dynload
    creating build/bdist.macosx-10.8-x86_64/python3.2-standalone/app/Frameworks
    *** creating application bundle: zymurgy ***
    tommyc  $
    
  6. Thomas Crawford reporter

    Just to follow up, when got the app successfully built. We had to uninstall pyzmq and zeromq (which are ipython dependencies) and then it works. No idea why.

  7. Log in to comment