8

I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to use for Python development:

  • "Stock" Apple Python
  • MacPython
  • Fink
  • MacPorts
  • roll-your-own-from-source

I'm still primarily developing for 2.5, so the stock Python is fine from a functionality standpoint. What I want to know is: why should I choose one over the other?

Update: To clarify, I am looking for a discussion of the various options, not links to the documentation. I've marked this as a Community Wiki question, as I don't feel there is a "correct" answer. Thanks to everyone who has already commented for their insight.

technomalogical
  • 2,982
  • 2
  • 26
  • 43
  • What kind of discussion of the various options are you looking for? Please clarify your question. What's wrong with the document at http://wiki.python.org/moin/MacPython/Leopard? What more would you like to see that's not in this document? – S.Lott Mar 02 '09 at 18:50
  • 1
    The page you linked to has one option: adding IDLE from MacPython to Apple's stock Python script. I would like to see more pros/cons of the various distributions, including personal experiences & reasons why SO users chose a particular distribution. – technomalogical Mar 02 '09 at 20:36
  • 1
    I think you meant to link to http://wiki.python.org/moin/MacPython/PythonDistributionsForMac, but that page is very terse and offers lots of vague terms like "too complicated" and "too many... packages". Plus, the page doesn't list many pros to the alternatives. I'm wondering if there are any. – technomalogical Mar 02 '09 at 20:39

11 Answers11

9

One advantage I see in using the "stock" Python that's included with Mac OS X is that it makes deployment to other Macs a piece of cake. I don't know what your deployment scenario is, but for me this is important. My code has to run on any number of Macs at work, and I try to minimize the amount of work it takes to run my code on all of those systems.

Craig S
  • 952
  • 4
  • 7
  • Avoid fink -- it installs some extra stuff with which you may not be happy. Use this: http://wiki.python.org/moin/MacPython/Leopard – S.Lott Mar 02 '09 at 11:06
  • 1
    assuming you can tolerate your python to be equally broken (I've pointed out three examples here on SO in the last two days that people had encountered in the real world) and _old_ on all the Macs, this is a valid point. – popcnt Mar 06 '09 at 16:14
  • As I implied, it all depends on your deployment requirements. I can't expect all machines here to be updated to Python 2.6 or some other configuration that isn't standard. But that's just me on this project. – Craig S Mar 06 '09 at 17:46
4

I would highly recommend using MacPorts with Porticus for managing your Python installation. It takes a while to build everything, but the advantage is that whatever you build yourself will be built against the same libraries, so you won't have to futz around with statically linked shared objects, etc. if you want your Python stuff to work with Apache, PostgreSQL, etc.

If you choose to go this way, remember to install the python_select port and use it to make your system use the Python installed from MacPorts.

As an added bonus, MacPorts has packages for most main-stream Python eggs, so if you should be able to have MacPorts keep you up-to-date with the latest versions of all that stuff :)

mikl
  • 23,749
  • 20
  • 68
  • 89
  • Plus the advantage of really easy installation of PIL (the only I found working). – zgoda Mar 05 '09 at 09:02
  • (This is an old question, bit I'm putting my two cents here anyways). I would strongly recommend **against** using macports for python on a mac, unless you are not doing any GUI stuff with python, or using any unusual libraries. – Fake Name Sep 05 '12 at 09:13
  • Basically, if you use macports-based python, it's very difficult to install any custom python packages, and it can make macports get confused if you do (in fact, the macports FAQ specifically says the only way you should install additional python packages is through macports, and you shouldn't install them any other way). – Fake Name Sep 05 '12 at 09:15
  • Second, if you do GUI work with python, all the libraries installed though macports will use X11, rather then native widgets. As such, they will pretty much all look ugly, and not fit in with other apple applications. – Fake Name Sep 05 '12 at 09:16
3

Here's some helpful info to get you started. http://www.python.org/download/mac/

Stig
  • 31
  • 2
3

Depends what you are using python for. If you are using MacOS funitionality and things like PyObjC you are probably best of with MacPython or the python provided by Apple.

I use Python on my Mac mostly for development of server side applications which later will run on FreeBSD & Linux boxes. For that I have used fink python for a few years and ever since MacPorts python. With mac ports it is simple to add required c modules (like database driver etc). It's also easy to keep two python Versions (2.5 & 2.6 in my case) around.

I used "compile your own" python to test pre-3.0 python but generally I find managing dependencies to c modules painfull if done by hand.

Thanks to easy_install installing pure python modules is fast and easy for all the options mentioned above.

I was never very much an IDE person. For development I use command line subversion installed by MacPorts, Textmate and occasionaly Expandrive do directly access files on servers. I personally are very dependent on Bicyclerepairman for Textmade to handle my refactoring needs.

Others seem to be very happy with Eclipse & Pydev.

max
  • 29,122
  • 12
  • 52
  • 79
3

How about EPD from Enthought? Yes, it's large but it is a framework build and includes things like wxPython, vtk, numpy, scipy, and ipython built-in.

2

I recommend using Python Virtual environments, especially if you use a Timecapsule because Timecapsule will back everything up, except modules you added to Python!

Bjorn
  • 69,215
  • 39
  • 136
  • 164
  • I like developing in a virtual environment. Makes it easy to add packages that may interfere with others. Cleans up the base system. – Matthew Schinckel Mar 02 '09 at 06:54
  • I agree esp. as the shipped python also ships with some addon libraries already which might clash with newer versions you need (I had this with zope.interface). virtualenv and your own python install prevent this. – MrTopf Mar 02 '09 at 10:44
2

Based on the number of bugs and omissions people have been encountering in Leopard python (just here on SO!), I couldn't recommend that version. e.g., see:

I would choose MacPorts.

It does not eliminate your existing python supplied by Apple since it installs by default in /opt/local/bin (plays nice with it) and plus it is easy to download and install additional python modules (even binary modules that you need to compile!). I use Porticus GUI to maintain my MacPorts installed list of packages, including python.

Community
  • 1
  • 1
popcnt
  • 4,519
  • 1
  • 16
  • 14
1

And guess what was forgotten by every answer here ... ActivePython.

No compilation required, even for third-party modules such as numpy, lxml, pyqt and thousands of others.

ActivePython Community Edition logo

Sridhar Ratnakumar
  • 81,433
  • 63
  • 146
  • 187
1

In my windows environment I use Eclipse and PyDev, which works quite well together, even if it's a bit sparse. Apparently the exact same environment is available for the Mac as well, so I suggest downloading Eclipse and using the internal update software function to update PyDev with the URL http://pydev.sourceforge.net/updates/. To look further into PyDev, look here.

Stefan Thyberg
  • 3,445
  • 3
  • 23
  • 29
1

Apple's supplied python is quite old – my tiger install has 2.3.5. This may not be a problem for you, but you would be missing out on a lot. Also, there is a risk that Apple will update it. I'm not sure if moving from 2.3.5 to (say) 2.4 would cause code to break, but I guess it's possible. This happened to perl people recently: http://developers.slashdot.org/article.pl?sid=09/02/18/1435227

Macpython is a framework build (as is Apple's, I believe). To be honest, I'm not sure exactly what that means, but it's a prerequisite for some modules, in particular wxPython. If you get python from macports or fink, you will not be able to run wxPython (unless you run it through X11).

John Fouhy
  • 41,203
  • 19
  • 62
  • 77
  • Good point about wxPython, something I had not considered. Apple has improved their Python support recently, with 2.5.2 being installed in Leopard, but the Perl issue is also a good point to raise. – technomalogical Mar 03 '09 at 14:21
0

I recommend python (any python?) plus the ipython shell. My most recent experience with MacPython was MacPython 2.5, and I found IDLE frustrating to use as an editor. It's not very featureful, and its' very slow to scroll large quantities of output.