Python conflict

Adam Dershowitz dersh at alum.mit.edu
Wed Dec 2 11:18:24 PST 2009



On Dec 2, 2009, at 10:08 AM, Ryan Schmidt wrote:

> 
> On Dec 2, 2009, at 12:03, Adam Dershowitz wrote:
> 
>> I am trying to use a binary package that also relies on python.  But it seems to expect the default apple python to be installed.  So, I have run:
>> sudo python_select  python26-apple
>> 
>> Yet when I run the binary, I see the following:
>> Python 2.5.4 found.
>> 
>> Or, if I run a different version of the binary, I see:
>> Python 2.6.4 found.
>> 
>> The apple version that is installed on my system (10.6.2) is 2.6.1 while macports has installed 2.5.4 and 2.6.4.  So, it seems that the application that I am running is finding the macports versions and not the apple version even though I have run python_select.
>> 
>> I have macports 1.8.1 and have done a recent sync.  The application that I am trying to run is GRASS and I have been using this set of binaries:
>> http://www.kyngchaos.com/software:grass
>> (although I also tried this one:  http://www.public.asu.edu/~cmbarton/files/grass_mac )
>> 
>> The problem comes up when I am trying to use their wxpython interface.  These two builds include wxpython and expect to use the system version of python, I was told.  But clearly something is funny if I run python_select for the apple version yet they are finding the macports python.
> 
> I wonder how it is finding python, or if there is a way to tell it which python to use.

I figured things out, with some help from some of the GRASS guys.
The problem is that their startup script first tries to find python2.6 (or, in this case pythonw2.6).  Macports doesn't change that link.  So pythonw2.6 points to the ports version, while pythonw points to whatever python_select sets.  

The work around is that GRASS will actually respect the env var GRASS_PYTHON.  So just putting this in my profile:
export GRASS_PYTHON=/usr/bin/pythonw2.6

got it working.  

I am not sure if this will come up with other apps or not.  But grass wants to try to first find the same version of python that it specifically expects, so it tries to find it with the numbers in the name.  Then, if that fails, it would take what it can get, or give an error.  So that is why it uses pythonw2.6 to run things.  I would guess that other apps might also run into this.  


More information about the macports-users mailing list