Installing PyDev on OS X 10.5.2
April 28th, 2008 Posted in Google App Engine, OS X, PyDevUpdate: If you are receiving an error when attempting to point PyDev to the OS X 10.5 install of Python 2.5 and are looking for the proper path to fix the error, then feel free to skip my rant by jumping down to here.
During the weekend I decided to begin playing with the Google App Engine and see what all the hubbub was about. Like most developers I couldn’t get into the preview (yet) but I could download and run the SDK. The SDK is all Python, a language I knew a little about but never delved into. Actually, the only thing I knew about it was that whitespace matters and having a good IDE is critical. Knowing this I looked up IDE options and found a plugin called PyDev for my favorite IDE, Eclipse.
After taking a brief look at the feature set I saw the important ones; code completion, debugging, refactoring and I was sold. I downloaded the plugin into Eclipse 3.3.2 and fired it up. The fist first thing I tried to do was create a new project, when I tried that I got a message informing me that I had to define the Python interpreter settings before I could create a project. Okay, makes sense to me.
I looked up the help docs and it said to open Eclipse > preferences > PyDev > Interpreter – Python, choose new… from the Interpreters section and point to my Python install directory. I knew that OS X Leopard has Python built in so I look into the usual locations such as ~/Library/, /Library/ and /System/. Nothing obvious jumped out so I did a quick search on the web and find the default install location is:
/System/Library/Frameworks/Python.framework/
Awesome, so I point the Interpreter to the Python exec yet it won’t let me choose it. Well, it is a symlink so maybe I need to go to the actual exec. I know that OS X has 2.5 installed so I navigate down to:
/System/Library/Frameworks/Python.framework/Versions/2.5/
and try to choose the Python exec located there. It accepts this location and then when I select it I get the “Error getting info on interpreter” dialog. What the hell does that mean? It has some notes in the dialog that says that common errors include specifying an invalid interpreter and/or spaces in the Eclipse path. Oops. I have have a space in my Eclipse path, I fix it then try again. Same error. Hmmmm….
There is also a bug documentation URL referenced in dialog so I do some searching and it tells me that if you get this error you are pointing to an invalid interpreter. Well duh, the dialog told me that much. What frustrates me is that the bug URL has the people responding back with “Hey, I fixed it.” with no statement on how, just that they fixed it! Okay, that’s not helping… time to do some testing.
I try using 2.3 to see if that works. Nope, same error. Okay, what other paths are there? I do some more digging and find out there is actually an APP file located at:
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/
I try both the Python.app and Python Launcher.app. This time a get a different error:
Check your error log for more details.
More info can also be found at the bug report:
http://sourceforge.net/tracker/index.php?func=detail&aid=1523582&group_id=85796&atid=577329
java.io.IOException: /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app: cannot execute
WTF!?!? I do more digging and people are having the same issue but NO WHERE IS IT DOCUMENTED ON HOW TO FIX IT!?!?! Okay, deep breaths… I want to use this plugin and people have it working in OS X and swear by it, I must prevail!
I do some more searching and stumble upon a forum that talks about getting PyDev running with Maya.
Update: Gabriel Lamounier provided the direct path to Python for Leopard in the comments section for my original post. He points out that the correct path is:
/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
I verified it and PyDev does like this path. Thanks Gabriel, I swore I tried this path during my testing but I must not have, after multiple hours of digging it’s sometimes easy to miss the semi-obvious. So, the easy answer is… use this path when setting up your Python interpreter. For grins, read the rest of the post to find out the “hack” way I came upon.
It seems that you cannot point to the APP but you have to point to the contents in the APP which contains the Python interpreter. sigh Seriously, who would have thunk it? So, the path for the Python interpreter in OS X 10.5 is:
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/ Contents/MacOS
Remember, an OS X APP is really just a fancy Directory. But wait, there’s more! You can’t actually navigate to the contents of an APP file from your standard OS X open dialog. Well thank god for kessaris who posted the Maya solution because he mentions that when you are in the open dialog you can press SHIT-CMD-G SHIFT-CMD-G to open a URL dialog that allows you to paste a path in. In most cases you have to Right click (CMD-Click) > Paste… to get the path in, but once you do you will see the Python interpreter in the MacOS folder. Select it and it works! You are now off to the Python races.
I want to give a big shout out to kessaris, whoever you are, for posting this incredibly helpful reply. Also, I hope this post helps someone install PyDev, because it really, really is a great IDE. More on PyDev and the Google App Engine coming soon!!
17 Responses to “Installing PyDev on OS X 10.5.2”
By webnesto on Apr 28, 2008
I’m going to point out two items, that at first I thought were typos… and then I realized it was your inner rage at this nightmare channeling its way out in your writing:
1. “The fist thing I tried to do …” one hardly wants to hear how that line finished
2. “SHIT-CMD-G”… I have desperately looked for the SHIT key on my keyboard many a time. I guess since I don’t use a mac, I don’t have access to it.
Oh, and kudos to you for posting this solution, with a name that will (hopefully) come up early for the next poor soul Googling for a solution.
By James on Apr 29, 2008
Y yo sae me spelle ungood?
Seriously, I need to get a copy editor to review my rapidly written rants before I hit the post button. Of course now that you have “commented” on my “typo’s” I have to leave them in with a strike, forever showing my poor writing abilities. Still, they are pretty funny typos…
By webnesto on Apr 29, 2008
Yes, well I am firmly opposed to revisionist history. I like to think that comments like mine help the internets be slightly more stable than it would be otherwise.
By Matt on Apr 30, 2008
Kudos indeed! As ‘the next poor soul’, I can attest that it is very easy to find. Thanks!
By James on May 1, 2008
Thanks Matt! I just made a new post that talks about the best way to configure PyDev for the Google App Engine:
http://blog.vivisectingmedia.com/2008/05/run-an...
By James Vivian on May 31, 2008
I’ve been wondering how to do this, and thanks to google I ended up here! I had gotten up to the SHIFT-CMD-G dialog and pasted in the url via CTRL-Click, but when I clicked Ok, I got a “oops, can’t do that” system beep. Maybe it’s a difference with 10.5.3 vs 10.5.2, but I had to Go to /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/
Contents/ and then open the MacOS folder in the open dialog, then I was able to select the interpreter.
Now it appears that everything went ok, but if I run into any more problems, I’ll post back.
My goal is to get Django running in Eclipse with PyDev, and while I’m sure a bunch of other people have gone down that road, I haven’t found a one-stop howto yet. I’ll be putting together a series of posts at http://trysteria.blogspot.com/
By James Vivian on Jun 1, 2008
Thought I had updated but guess I hadn’t. That rules out version differences…
By Hywel on Jul 3, 2008
Beauty! I was having the same problem with those non-explanatory “I’ve fixed it!” posts.
Cheers!
By Mark Allen on Jul 13, 2008
Thanks a lot! Had the exact same problems trying to install PyDev, and this cleared it up completely. I had no idea that Cmd-Shift-G existed!
By Gabriel Lamounier on Jul 22, 2008
The correct location for the python interpreter on Leopard is: /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
By James on Jul 23, 2008
Thanks Gabriel, I have updated the post to reflect this path.
By Jason on Oct 2, 2008
Thanks for this post. For all the good things the Mac does, finding things sometimes is a real pain!!
By tylerbutler on Oct 2, 2008
Thanks a lot for the info!
By Rob Collins on Sep 18, 2009
Thank you. This process was 8X more complex than it needed to be. I appreciate you taking the bullet, to make it easier for the rest of us.
By Royston Sellman on Nov 23, 2009
Note that Python can be in multiple places on your Mac. Find out which one is being used by default on your system: From a Terminal window type e.g:
echo $PATH
and you should see the route to python binary.
Also in Terminal to see how many copies you have on your machine try:
locate python2.5
and
locate python2.6
I upgraded to python2.6 by installing IDLE and that put python in: /Library/Frameworks/Python.framework/Versions/2.6
Note this is not the same as the “correct” location mentioned above.