[Pythonmac-SIG] py2app not including /Library/Python/2.6/site-packages

michael ferraro michael at possibleworlds.com
Sun Jan 23 19:34:10 CET 2011


I have seen various posts regarding this problem over the years but I flummoxed
by how I got here and what to do now that I am.

I am running MacOS X 10.6.6 I started out using the system python 2.6.  I built the
3d extensions (PyQt, numpy, PyOpenGL &c) and they are installed in 
	/Library/Python/2.6/site-packages

As I expected. My app runs fine when invoked directly from the Terminal.

Poor internet search results trying to locate and install py2app resulted
in the installation of ActiveStates pypm and Macports hg along with some
variants of easy_install. These missteps seem to have installed another
version of python 2.6 in the path of /Library/Frameworks/Python.framework
chain with it own site-packages folder. 

As a result  my installed 3d party extension were no longer found when starting
the app  from the Terminal.  Once I removed this framework. and the .local folder
created in my home folder.  I also removed the .profile file that was modified
(created) by one of the previous installs.  I discovered some installed put a
python in /usr/local/bin and removed it.

I tested my app from the Terminal and all was good again.  The sys.path variable 
prints the expected site-packages.

['/Users/mef/Development/-Applications-/Teatro',
 '/Library/Python/2.6/site-packages/setuptools-0.6c12dev_r88124-py2.6.egg',
 '/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg',
 '/Library/Python/2.6/site-packages/macholib-1.3-py2.6.egg',
 '/Library/Python/2.6/site-packages/modulegraph-0.8-py2.6.egg',
 '/Library/Python/2.6/site-packages/altgraph-0.7.0-py2.6.egg',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
 '/Library/Python/2.6/site-packages',
 '/Library/Python/2.6/site-packages/PIL',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']


After I run python setup.py py2app
I run dist/Teatro.app and the sys.path contents printed to the console looks like this:

1/23/11 1:07:09 PM	com.apple.launchd.peruser.501[420]	([0x0-0xec0ec].org.pythonmac.unspecified.Teatro[25180]) Exited with exit code: 255
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	['/Users/mef/Development/-Applications-/Teatro',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/Users/mef/Development/-Applications-/Teatro/dist/Teatro.app/Contents/Resources',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/Users/mef/Development/-Applications-/Teatro/dist/Teatro.app/Contents/Resources',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/usr/lib/python26.zip',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/usr/lib/python2.6',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/usr/lib/python2.6/plat-darwin',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/usr/lib/python2.6/plat-mac',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/usr/lib/python2.6/plat-mac/lib-scriptpackages',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/usr/Extras/lib/python',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/usr/lib/python2.6/lib-tk',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/usr/lib/python2.6/lib-old',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/usr/lib/python2.6/lib-dynload',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/Users/mef/Development/-Applications-/Teatro/dist/Teatro.app/Contents/Resources/lib/python2.6/site-packages.zip',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/Users/mef/Development/-Applications-/Teatro/dist/Teatro.app/Contents/Resources/lib/python2.6/site-packages',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/usr/lib/python2.6/site-packages',
1/23/11 1:07:23 PM	[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]	 '/Users/mef/Development/-Applications-/Teatro']


What should I do here.  I think from what I have read I should NOT add a site-packages link in
/usr/lib/python2.6.  or is it that I mangled the installation of the system python somehow ?



m





On Jan 23, 2011, at 12:33 PM, michael ferraro wrote:

> I eliminated the 1st of my problems by turning off argv_emulation.  That takes
> care of the Evt.TickCount problem .  
> 
> But I am running afoul of the site-packages problem when I run the built app
> 
> I will repost as an new thread for clarity
> 
> m
> 
> On Jan 22, 2011, at 9:34 PM, michael ferraro wrote:
> 
>> Hello all and thanks for listening!
>> 
>> I have scanned the archive and the web for current practices in packaging an Mac Python app with
>> py2app.  I have been successful before (i.e circa python 2.4 and Mac OS X 10.4).  I am now working
>> on under 10.6.6 and python 2.6.6.18 as shipped with the OS.  I am  using PyQt 4.8.2. as an i86_64
>> app.  It runs fine from the terminal as
>> 	python Teatro.py
>> 
>> 
>> I used 
>> 	easy_install-2.6 -U py2app which retrieved and installed py2app 0.5.2. 
>> 
>> I used a couple of variation of what seem to be standard procedure to create the
>> app including
>> 	/Library/Frameworks/Python.framework/Versions/2.6/bin/py2applet --make-setup --alias --argv-emulation Teatro.py
>> 
>> followed by:
>> 	python setup.py py2app
>> 	python setup.py py2app -A
>> 
>> as well as
>> 	/Library/Frameworks/Python.framework/Versions/2.6/bin/py2applet Teatro.py
>> 
>> the setup.py file looks like this:
>> 
>> """
>> This is a setup.py script generated by py2applet
>> 
>> Usage:
>>   python setup.py py2app
>> """
>> 
>> from setuptools import setup
>> 
>> APP = ['Teatro.py']
>> DATA_FILES = []
>> OPTIONS = {'alias': True, 'argv_emulation': True}
>> 
>> setup(
>>   app=APP,
>>   data_files=DATA_FILES,
>>   options={'py2app': OPTIONS},
>>   setup_requires=['py2app'],
>> )
>> 
>> when I try to run the app (Teatro.app or dist/Teatro depending on which procedure I used
>> to build it) i get this:
>> 
>> <Screen shot 2011-01-22 at 9.16.41 PM.png>
>> 
>> 
>> The console reports:
>> 
>> 1/22/11 8:44:43 PM	com.apple.launchd.peruser.501[420]	([0x0-0x51051].org.pythonmac.unspecified.Teatro[899]) Exited with exit code: 255
>> 1/22/11 9:16:30 PM	[0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]	Traceback (most recent call last):
>> 1/22/11 9:16:30 PM	[0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]	  File "/Users/mef/Development/-Applications-/Teatro/Teatro.app/Contents/Resources/__boot__.py", line 103, in <module>
>> 1/22/11 9:16:30 PM	[0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]	    _argv_emulation()
>> 1/22/11 9:16:30 PM	[0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]	  File "/Users/mef/Development/-Applications-/Teatro/Teatro.app/Contents/Resources/__boot__.py", line 101, in _argv_emulation
>> 1/22/11 9:16:30 PM	[0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]	    _get_argvemulator().mainloop()
>> 1/22/11 9:16:30 PM	[0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]	  File "/Users/mef/Development/-Applications-/Teatro/Teatro.app/Contents/Resources/__boot__.py", line 40, in mainloop
>> 1/22/11 9:16:30 PM	[0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]	    stoptime = Evt.TickCount() + timeout
>> 1/22/11 9:16:30 PM	[0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]	AttributeError: 'module' object has no attribute 'TickCount'
>> 1/22/11 9:16:30 PM	Teatro[982]	Teatro Error
>> 
>> 
>> When I build using 
>> 	python setup.py py2app Teatro.py without alias and argv_emulation in the setup.py
>> 
>> 
>> /usr/bin/strip: for architecture x86_64 object: /Users/mef/Development/-Applications-/Teatro/dist/Teatro.app/Contents/Frameworks/Python.framework/Versions/2.6/Python malformed object (load command 3 cmdsize not a multiple of 8)
>> stripping saved 333408 bytes (8961700 / 9295108)
>> 
>> as the last line of the build and in the build directory i get
>> 	dist.macosx-10.5-intel/
>> 
>> but away get the same result as above when I try to run the app
>> 
>> 
>> 
>> I am sure it is obvious what is wrong but I have reach a dead end.  
>> 
>> Any help would be appreciated
>> 
>> 
>> Michael Ferraro
>> Assoc. Prof. 
>> Art Dept.
>> Lehman College CUNY
>> Bronx, NY
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20110123/9d14b7a5/attachment-0001.html>


More information about the Pythonmac-SIG mailing list