BruceSherwood/vpython-wx

setup.py needs switch to build against homebrew python

Closed this issue · 3 comments

vpython-wx compiles! However,

>>>from visual import *
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

Cursory googling suggests this could be due to linking against the wrong python. An inspection of my executable reveals:

$ otool -L cvisual.so
cvisual.so:
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 20.0.0)
    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

which is not what I want - I'm trying to build vpython-wx against the version of python 2.7.6 that I have installed under homebrew (and I've already built boost against that version). My suspicion is that the problem is in setup.py:135

if os_host == 'mac': 
    os.environ['LDFLAGS'] = '-framework Cocoa -framework OpenGL -framework Python'

it seems like setup.py maybe needs a switch to tell it which Python to link against?

c.f. http://bugs.python.org/issue16848

Hi April,

I'd love to make setup.py more flexible. At the moment it's only tested against python.org python. Did you build the boost libraries with brew? Did you build wxpython 2.9+ with brew? Does brew create a framework build of python to link against? I guess I need to learn more about brew/Enthought/Anaconda/fink/macports/whatever before I have a hope of getting this right!

thanks,
-steve

On Apr 9, 2014, at 4:07 AM, April Arcus notifications@github.com wrote:

vpython-wx compiles! However,

from visual import *
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

Cursory googling suggests this could be due to linking against the wrong python. An inspection of my executable reveals:

$ otool -L cvisual.so
cvisual.so:
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 20.0.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

which is not what I want - I'm trying to build vpython-wx against the version of python 2.7.6 that I have installed under homebrew (and I've already built boost against that version). My suspicion is that the problem is in setup.py:135

if os_host == 'mac':
os.environ['LDFLAGS'] = '-framework Cocoa -framework OpenGL -framework Python'

it seems like setup.py maybe needs a switch to tell it which Python to link against?

c.f. http://bugs.python.org/issue16848


Reply to this email directly or view it on GitHub.

Hi @AprilArcus.
I guess you are right about the LDFLAGS.
Some time ago I wrote a formula for vpython and faced the same issue. It was picking up the system Python, not the brewed one.
Back then I told setup.py explicitly the location of the Python framework.
I was cleaning up the formula [1], but right now I am also stuck with the issue #46.

@sspickle yes, last time I build vpython against brewed boost, wxmac and wxpython. Homebrew build a Python as framework by default, and universal if the user ask for it.

Regards, Guilherme

[1] https://github.com/guitorri/homebrew-tap/blob/master/vpython.rb

I think this has been resolved. Can you try your build again?