Pygame, panda3d, maya and python playing nice on osx.

Okay, this is mainly for my own reference, but maybe it will help other people too. There are still a few mysteries, but overall it seems to work.

I struggled getting all these running together under OSX 10.6.4, and it turns out it was a result of me trying too many things, and not really understanding what I was doing. As a result I got very flustered and confused a lot of nice people on IRC and forums with my issues.

Cleaning Up:
The way I managed to get everything running was to remove all traces of non-system pythons. The ones in /Library/Frameworks/Python.framework/ Once they were gone I found that I still had some mystery pythons running. Turns out that I had managed to install some copies with ‘macports’ too. I removed everything I had installed with macports, and added back in only the things I knew I needed.

The only python I now have on my system is in: /System/Library/Frameworks/Python.framework/Versions
There is a 2.4, 2.5 and 2.6 in there, that confuses me and I don’t really understand why or how. I’m hoping that they are all just put there by OSX. Anyway I managed to get it all working with 2.5

Now that things are clean, I commented out a bunch of stuff from my .bash_profile. Mainly $PYTHONPATH and $PYTHONHOME. Keep them around though, you may want to add a few back in later.

Installing pygame:
I tried lots of things, but this is what worked for me in the end. I downloaded pygame-1.9.1release-py2.5-macosx10.5.mpkg and installed that. When you go through the installer it will not let you continue because it can’t see python 2.5 on your system. I think this is because it’s looking in the /Library/Frameworks path I mentioned earlier. Mine is empty.

I got it running by clicking on the pygame-1.9.1release-py2.5-macosx10.5.mpkg and choosing ‘Show Package Contents’ and then installing each of the packages in Contents/Packages. This went smoothly.

Once all these were installed I updated my $PYTHONPATH in the .bash_profile to:

export PYTHONPATH="/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/"

So now I can open a terminal and import pygame, and it all works :slight_smile:

I added the panda directory too:

export PYTHONPATH="/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/:/Developer/Panda3D/lib/"

It would be worth looking over your original commented out PYTHONPATH, and adding back in any you thought were useful too. Keep this as a reference, because other modules may not appear in the shell anymore.

Getting the maya modules to work:
Now the only way I could work out how to get maya into the interactive shell, was to use the $PYTHONHOME variable.

export PYTHONHOME=/Applications/Autodesk/maya2009/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/

Now in the terminal I can launch python (2.5.4) and import maya, pygame and panda3d libraries, along with the usual modules. Panda examples still execute as normal, but I haven’t yet tested out the rest.

In conclusion:
Don’t try another way of doing something, until you understand why the current approach isn’t working.

I’m not saying I understand exactly what I have done, but I know I have learnt a lesson about persisting with something, and then going back to basics when it’s not working.

Thanks for the patience and help from those who tried to lend a hand over the past couple of days :slight_smile: