UPDATE: Thanks to the helpful commenters, I found success getting an older Zope instance running on Python 2.4 on Snow Leopard using buildout.
NOTE: This post is for installing Python 2.4 on a brand new Snow Leopard Instance. If upgrading on top of Leopard, you may have to update easy_install, macports, etc. More Googling around may be required.
Though I had to create two buildouts to get this to work — is there a way to get this into one buildout?
I first tried to create one buildout by combining Florian Schulze’s buildout recipe with a standard Zope recipe — but since initial bootstrap was run by Python 2.5, I couldn’t get the Zope instance to use the new Python 2.4. So I first ran a buildout to build Python 2.4 (using OSX-installed Python 2.5), then used that new Python 2.4 to run bootstrap.py on the Zope 2.8.x buildout.
Here’s the recipe I used to just build Python 2.4 (requires Florian’s buildout, see Alexander Limi’s comment below for where to find this):
[buildout]
#extends = src/snowleopard.cfg # no longer required as Joe mentions below
python-buildout-root = ${buildout:directory}/src
parts -=
${buildout:python25-parts}
${buildout:python26-parts}
[install-links]
prefix = /opt/local
Then I ran a simple Zope 2.8 buildout to see if it would compile (using new Python 2.4 to bootstrap), and it did!
[buildout]
parts =
zope2
instance
[zope2]
recipe = plone.recipe.zope2install
url = http://www.zope.org/Products/Zope/2.8.9.1/Zope-2.8.9.1-final.tgz
[instance]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
user = admin:admin
http-address = 8080
debug-mode = on
verbose-security = on
Here is my initial post:
I have to say — most everything I’ve installed on a fresh Snow Leopard install has worked flawlessly and swiftly — except for (the minor inconvenience of) iStat not working. UPDATE: iStat 2.0 is available for Snow Leopard now. There’s a new beta of MenuMeters too for Snow Leopard.
There are also nice subtle improvements, see Mac Life’s 100 Top Snow Leopard Tips, Trick and Features for improvements to Preview, Expose, Stacks, etc. I’ve very happy with the upgrade.
Now for the bad news for those like myself who depend on Python 2.4 for Plone, since many versions of Zope require Python 2.4. I also use Python for Django, though that should run fine on Python that shipped with Snow Leopard.
You can read many of the initial details around the web, but here’s what I’ve experienced and have been able to put together:
- Note that these details are for a fresh Snow Leopard install – there are a different set of issues if you’re upgrading over your existing Leopard. NEW: “Clark’s Tech Blog” has a nice write-up about upgrading Python after upgrading Leopard to Snow Leopard.
- Snow Leopard ships with Python 2.5.4, and this runs as a 32-bit application.
- I also need 2.4 branches of Python too, so I tried rolling my own (as usual) and it didn’t compile. I then followed that thread for awhile.
- I then thought I pulled a fast one when I compiled from MacPorts and everything ran great!
- … but then I compiled Zope, and attempted to run an instance. I saw a mysterious “No such file or directory” error. Hmmm, I can navigate to that file, but running the script with my new Python interpretor was causing this error.
- After digging around with Activity Monitor, I discovered that the Python I built from scratch was running as a 64-bit app — while the Python that comes with Snow Leopard was only running 32-bit — which is telling, since most everything else on Snow Leopard is running 64-bit.
- Guessing that the the mysterious “No such file or directory” (when the file and directory did indeed exist) was due to a weird cocktail of 32-bit pieces living with 64-bit pieces.
- My latest theory was that I needed to figure out how to build Python as 32-bit. I played with Macports and various architecture settings to hardwire this, but long-story-short — the architecture override isn’t used everywhere — so parts still compile natively as 64-bit on Snow Leopard.
- The best thread on the topic (that’s steadily growing) is here: http://bugs.python.org/issue6802 with msg92153 left today, which basically offers some additional settings for compiling Python as a 32-bit app (for Python 2.6). Also mentions that Snow Leopard did some magic to get Python 2.5 working as a 32-bit app.
- My hope is that once “32-bit” Python 2.4 happens, the rest of the Zope install, etc, will be back to the good ol’ days in Leopard.
Plan B’s:
Otherwise, to save some headache, I’m wondering about installing a small Linux distro on VMWare as a local mini web-server where I can easily install Python and Zope — though that’s a bit of a pain too.
Luckily I also have my old Leopard in a separate partition (see my Extra life for my MacBook Pro with Snow Leopard and inexpensive hardware blog entry) and can boot that if necessary to work on various Zope/Plone sites (that required Python 2.4) while this is all being sorted out.
Now time to see if I can get 32-bit Python 2.4.6 compiled and installed, while waiting for more patches and information to appear…
Some quick comments:
- iStatMenus has a beta out that runs on Snow Leopard (you have to contact them to get access — but I’ve been running it for a few weeks, works great)
- The upcoming Plone 4 uses Python 2.6, and therefore works with the system Python in Snow Leopard. I’m doing all my Plone 4 development with it, and it works great.
- Florian Schulze has created a buildout which can compile Python 2.4, 2.5 and 2.6 for you on Snow Leopard. Here’s how:
svn co http://svn.plone.org/svn/collective/buildout/python/
cd python
python bootstrap.py
bin/buildout -c src/snowleopard.cfg
(wait, and you should have 2.4 and friends inside the src/ directory)
I haven’t tried running Plone 3.x with it yet, but give it a try and let us know.
Interesting, I think I ran across at least one other person who experienced the “No such file or directory” weirdness. For the record, Florian’s buildout works fine with 3.3 (thanks Florian!) The MacPorts Python 2.4 will compile, but does not contain #undef _POSIX_C_SOURCE in pyconfig.h so you get a “ImportError: cannot import name ESHUTDOWN” when starting Zope 2 (Florian’s patch fixes this, among other things). Thanks for the writeup!
For some of my development work, I have been using a VMware instance on my MacBook that closely matches my live deployment servers that run Debian. This works very well, but obviously increases system RAM and hard drive requirements.
FTW, with above mentioned Python buildout from Florian (kudos) I get Plone 3.2.1 and 3.3 running.
Unfortunately the current trunk (Rev 97076) does not work anymore on Snow Leopard. If I use revision 96739, everything is fine. I get this error:
$ python bootstrap.py
Traceback (most recent call last):
File “bootstrap.py”, line 39, in
ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
KeyError: ‘use_setuptools’
FWIW, if I follow Alexander’s instructions above, this fails with the following error:
Error: Couldn’t open /Applications/Plone3.3/python/src/src/snowleopard.cfg
Bootstrap created another bin directory with another buildout inside of src.
So if I cd to src, then I can run: bin/buildout -c snowleopard.cfg. That seems to work, but now that it’s done, I really don’t know how to start the instance. Don’t see a zopectl file anywhere.
FWIW, if I follow Alexander’s instructions above, this fails with the following error:
Error: Couldn’t open /Applications/Plone3.3/python/src/src/snowleopard.cfg
Bootstrap created another bin directory with another buildout inside of src.
So if I cd to src, then I can run: bin/buildout -c snowleopard.cfg. That seems to work, but now that it’s done, I really don’t know how to start the instance. Don’t see a zopectl file anywhere.
I’ve been able to install python2.4 (Universal MacPython dmg) and get Zope 2.95 running on Snow Leopard but everything breaks down when compiling MySQL-python (required for ZMySQLDA).
I get the following error:
cc1: error: unrecognized command line option “-Wno-long-double”
error: command ‘gcc’ failed with exit status 1
Similar to what I get when trying to compile python2.4 on Snow Leopard from scratch.
Any ideas how to fix this? Can this buildout method be used to successfully install MySQL-python?
Thanks for the great post!
-Seth
Duh — I get it now. For some reason, I assumed this was a buildout for a Plone site (my main usage for buildout), but that’s obviously not the case. This will only give you a python install that will work with your Zope on Snow Leopard, which is exactly what I needed.
It’s been updated since Alexander first commented; you no longer need to designate the snowleopard.cfg file (indeed, that file is no longer there). So, follow the instructions above, but bin/buildout should do the trick.
Sorry if I clouded the issue with my earlier comment
.