Hi All,

I would like to write a setup.py script for py2app, but I keep bumping
into an error I don't know how to resolve:

How do I specify a dependency on PyQt4 ?
 * If I do not tell py2app about the dependency, it successfully
creates a Mac OS X application package, but fails to run it as it
cannot find the PyQt4 libraries
 * If I specify 'PyQt4' as a dependency in setup.py, py2app fails to
resolve this dependency and refuses to build up the package, with the
following error from the underlying pkg_resources module:

Traceback (most recent call last):
  File "setup.py", line 54, in <module>
    setup_requires = ['py2app'],
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py",
line 152, in setup
    dist.run_commands()
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py",
line 975, in run_commands
    self.run_command(cmd)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py",
line 994, in run_command
    cmd_obj.ensure_finalized()
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/cmd.py",
line 117, in ensure_finalized
    self.finalize_options()
  File "/Library/Python/2.6/site-packages/py2app/build_app.py", line
295, in finalize_options
    self.eggs = require(self.distribution.install_requires)
  File 
"/Library/Python/2.6/site-packages/distribute-0.6.10-py2.6.egg/pkg_resources.py",
line 648, in require
    needed = self.resolve(parse_requirements(requirements))
  File 
"/Library/Python/2.6/site-packages/distribute-0.6.10-py2.6.egg/pkg_resources.py",
line 546, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: PyQt4

I've added the following dependency requirement in the setup.py file

    install_requires = [
        'PyQt4'
    ],

When I run python from the command line, I don't have any issues to load PyQt4:

Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4
>>> print PyQt4
<module 'PyQt4' from '/usr/local/homebrew/lib/python/PyQt4/__init__.pyc'>
>>>

Moreover, the application loads and executes fine when it is run from
the command line.

However, py2app keeps failing to find PyQt4.

Any idea about how to solve this issue? I've googled it but had no
luck, "pkg_resources.DistributionNotFound: PyQt4" gives no answer.

Thanks in advance,
Manu

If that matters: Snow Leopard 10.6.2 w/ full 64 bits installation on a
MBP Unibody
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to