Yak Shaving for VirtualEnv on osX 10.6.8 Snow Leopard Python

So apparently Yak Shaving is the term computer programmers use to describe the slow, tedious processes the are involved in installing and properly configuring applications, modules, etc – and anything generally NOT creative that needs to be accomplished in order to move on to more rewarding adventures.

This article will probably server to do little more than remind me of certain aspects of the current adventure and offer a glimpse into the potentially very chaotic and confusing mental environment involved in shaving Yaks.

Today it was trying to make virtualenv – a python module which enables the user to create virtual python environments – work on this osX 10.6.8 laptop. Some people might suggest this laptop and/or OS version are outdated, but keep in mind that the planned obsolescence of technology is tied up with unethical environmental and labor practices, so there’s something to be said for using what we’ve got as long as possible.

At any rate there’s a blog article that many people have turned to when facing issues with the way Python is built in OS X. This one by Wolf Paulus.

The error when trying to run virtualenv was something along the lines of:

selenium:~ auser$ virtualenv new  
New python executable in new/bin/python  
ERROR: The executable new/bin/python is not functioning  
ERROR: It thinks sys.prefix is u'/System/Library/Frameworks/Python.framework/    Versions/2.6' (should be '/Users/user/new')  
ERROR: virtualenv is not compatible with this system or executable  

And the Stack Overflow answers ran the gammut from “use pythonbrew instead” to “add bla bla to your path” to “completely uninstall python and reinstall it using homebrew.”

make: *** [Python/mactoolboxglue.o] Error 1
make: *** Waiting for unfinished jobs....

I READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting

These open issues may also help:

byobu needs brewed python (https://github.com/Homebrew/homebrew/pull/29542)
Fix up sys.path for brewed python (https://github.com/Homebrew/homebrew/pull/28597)
byobu: Python crashes when executing the program on 10.9 (https://github.com/Homebrew/homebrew/issues/30252)
/usr/bin/env replaces to invalid Python shebang line (https://github.com/Homebrew/homebrew/issues/30140)
vim does not build with Python support on OS X Mavericks (https://github.com/Homebrew/homebrew/issues/30617)
libxml2 –universal –with-python failed to import on 10.8.5 (https://github.com/Homebrew/homebrew/issues/30126)
Default distutils CFLAGS/LDFLAGS cause issues with Python extension modules (https://github.com/Homebrew/homebrew/issues/26272)
cmake find_package(PythonLibs) broken with brewed python on 10.9 (https://github.com/Homebrew/homebrew/issues/25118)

/usr/local/Cellar/git/2.0.1 sysconfdir=/usr/local/etc

The OS X keychain credential helper has been installed to:

The 'contrib' directory has been installed to:

Bash completion has been installed to:

zsh completion has been installed to:

An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied - /usr/local/lib/perl5

drwxrwxr-x    19 mikekilmer  admin    646 May 28 12:54 local
sudo chown -R $USER:admin /usr/local


Warning: Broken symlinks were found. Remove them with `brew prune`:

Ultimately opted not to install all of X-tools, but instead went with this option provided by kenneth reitz, since I only really needed the GCC compiler (which is the program that puts all the pieces where they need to be with the correct permissions, etc – and I’m not sure what-all is included in etc).

Fetch, by FTP application of choice stopped working because I had ignorantly uninstalled Python2.7, not realizing that it is not only still totally relevant as a programming language, but that some OS X programs rely on it.

So I simply downloaded the Python installer from Python.org and I think it worked out of the box.

My links needed to be set to point to /Library/Frameworks/Python.framework/Versions/2.7/bin/python /usr/bin/python, but I think I have since removed them with no apparent negative effects. These do not exist on this laptop:

code class="unix">
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc /usr/bin/pydoc
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python /usr/bin/python
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw /usr/bin/pythonw
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python-config /usr/bin/python-config