Sunday, March 25, 2012

distribution dilemma or package predicament

I recently installed Requests, a Python package for HTTP requests, from the Ubuntu Software Center since that's become my habit, mostly because I foolishly believe that it will handle dependencies (if there actually are any) for me properly, and because I'm too scarred or lazy to handle the sometimes recursive  requirements an installation involves on my own. The downside of this is of course that packages in the Ubuntu repository (some are on Launchad) are maintained by volunteers, not always updated and, by their very nature of being Ubuntu, will always be at least 6 months old. In the case of Requests, the version on Ubuntu and Launchpad is version 0.5.0, there's an archived page on Github, and compared to the current version 0.10.7, you can see it has come a very long way! Lamely, the next release of Ubuntu, the Precise Pangolin will have Requests 0.8.2, also archived on Github.

This is the distribution dilemma, go with the distro, old but reliable (is it really?), or go it alone. The Python hacks will say the obvious, use pip, also available on Ubuntu, not nearly as outdated, which is Python's answer to apt-get/yum, i.e.: it will take care of installing dependencies for lazy, insecure me.

What do you think? When should you break from the fold? When do you stay in the warm embrace of your distro? Obviously the answer will be different for each user and circumstance. This time, I think I'm going have to buck up and jump out of the nest.

(*) Yay! I found a happy medium. I must say pip kicks ass!
marko@myBox:~$ pip freeze
Shows me all of my installed Python packages, and there's requests and it sorry outdated state.
Now ...
marko@myBox:~$ pip install --upgrade requests
Oh that didn't work, it couldn't uninstall the old requests because permission was denied.
So try ...
marko@myBox:~$ sudo pip install --upgrade requests
Ahh, success! I love linux! And I love the smartypants who wrote Pip! Thank you!

Update (2012-04-17): (*) Well I probably won't do that again. Please see Part 3. This approach works sometimes but can cause problems, and probably isn't optimal. My initial instincts, scared and lazy, were probably best. In the future, I'll only use pip in virtualenv, with the added plus, that I don't have to remember to precede it with sudo!
Fork me on GitHub