The Haphazard Blog

Perils of Updating Python on Your Mac

by on June 8, 2013 7:22 PM, under Software Development

As part of improving my skills, I started to learn Python, a popular scritpting (it can do more) language. So the natural first step was to get it installed. Mac OS X comes with many programming languages installed. My version of OS X Lion came with Python 2.7.1. While Python 3.1.3 was also out at that time, that was not included. They are now up to 3.3.2 and it seemed to make sense to me that I should get the latest. After all, I was learning the language, right? It’s easy enough to install, but the default python (which python) remains 2.7.1. So I set out to make 3.3.2 my new default. I found a tutorial on how to do this here. Learned some good things about OS X under the hood and everything seemed fine, until I went to update Office 2011.

I had started the Office 2011 update and then let it sit there when it asked me to quit Chrome (why does Office need me to quit my browser to update?) but I had some tabs open while working on some other stuff. A couple days later, I went to finish it up and it failed. So I thought maybe it was because I let it sit there in an intermediate state. So I tried again, and again (hey Microsoft, maybe you can save the installer locally instead of downloading it every time after it fails) with no luck. I then started to look into the install log (Command+L) and saw this error:

./preinstall: ImportError: No module named ‘popen2’

popen2 is a Python module. And I realized the problem was Python 3 vs Python 2. So I restored the symbolic links in /usr/bin back to Python 2.7.1 and the update worked fine. I did still leave 3.3.2 with the other versions and added 3.3 links to /usr/bin like the 2.7 ones. This seems like Microsoft’s fault because it’s crazy to think you should never upgrade Python. At some point Apple may (or maybe already has) install 3.x as the default. But reading more, it also seems to be my fault. Making changes to /usr/bin is a bad idea in OS X.

:, , ,

Leave a Reply