Issue 14188: Sharing site-packages between Apple and python.org builds breaks extensions (original) (raw)
I'm testing on Mac OS X 10.7.3
http://bugs.python.org/issue4865 added /Library/Python/2.7/site-packages to the path for python.org built 2.7.
This will work for .py files but .so cannot be shared. pysvn will SEGV python.org 2.7 when it is built against apple 2.7.
Because /Library/Python/2.7/site-packages is before /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages it is not possible to work around by install two binary kits.
To reproduce:
Install pysvn 1.7.6 for python.org Then run python.org 2.7 and import pysvn. This will work.
Install pysvn 1.7.6 for Apple python. python.org 2.7 import pysvn is now broken.
$ /usr/bin/python Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import pysvn pysvn <module 'pysvn' from '/Library/Python/2.7/site-packages/pysvn/__init__.pyc'> ^D
$ /usr/local/bin/python2.7 Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import pysvn Segmentation fault: 11
Sorry, I can't reproduce the problem. By default and by design, Library/Python/2.7/site-packages comes last in sys.path for the python.org installed Pythons. Are you sure you aren't overriding sys.path with a PYTHONPATH environment variable or some change to site.py?
$ /usr/bin/python2.7 Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import sys; from pprint import pprint as pp ; pp(sys.path) ['', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Users/pyi/Library/Python/2.7/lib/python/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages'] import pysvn pysvn <module 'pysvn' from '/Library/Python/2.7/site-packages/pysvn/__init__.py'> ^D pyb7:~ pyi$ /usr/local/bin/python2.7 Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. import sys; from pprint import pprint as pp ; pp(sys.path) ['', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Users/pyi/Library/Python/2.7/lib/python/site-packages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages'] import pysvn pysvn <module 'pysvn' from '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pysvn/__init__.py'>
I have wxPython installed. Uninstalling it changes the order of sys.path to this:
['', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7', '/Library/Python/2.7/site-packages', '/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7']
I'll take this up with the wxPython folks.