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/git/bin/git
git-2.0.1
/usr/local/Cellar/git/2.0.1 sysconfdir=/usr/local/etc


The OS X keychain credential helper has been installed to:
  /usr/local/bin/git-credential-osxkeychain

The 'contrib' directory has been installed to:
  /usr/local/share/git-core/contrib

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions

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

https://github.com/Homebrew/homebrew/issues/23032


Warning: Broken symlinks were found. Remove them with `brew prune`:
  /usr/local/bin/smtpd2.py
  /usr/local/bin/smtpd2.7.py
  /usr/local/bin/smtpd.py
  /usr/local/bin/pyvenv-3.4
  /usr/local/bin/pyvenv
  /usr/local/bin/pythonw2.7-32
  /usr/local/bin/pythonw2.7
  /usr/local/bin/pythonw2-32
  /usr/local/bin/pythonw2
  /usr/local/bin/pythonw-32
  /usr/local/bin/pythonw
  /usr/local/bin/python3.4m-config
  /usr/local/bin/python3.4m
  /usr/local/bin/python3.4-config
  /usr/local/bin/python3.4-32
  /usr/local/bin/python3.4
  /usr/local/bin/python3-config
  /usr/local/bin/python3-32
  /usr/local/bin/python3
  /usr/local/bin/python2.7-config
  /usr/local/bin/python2.7-32
  /usr/local/bin/python2.7
  /usr/local/bin/python2-config
  /usr/local/bin/python2-32
  /usr/local/bin/python2
  /usr/local/bin/python-config
  /usr/local/bin/python-32
  /usr/local/bin/python
  /usr/local/bin/pydoc3.4
  /usr/local/bin/pydoc3
  /usr/local/bin/pydoc2.7
  /usr/local/bin/pydoc2
  /usr/local/bin/pydoc
  /usr/local/bin/pip3.4
  /usr/local/bin/pip3
  /usr/local/bin/phpunit
  /usr/local/bin/idle3.4
  /usr/local/bin/idle3
  /usr/local/bin/idle2.7
  /usr/local/bin/idle2
  /usr/local/bin/idle
  /usr/local/bin/2to3-3.4
  /usr/local/bin/2to3-2.7
  /usr/local/bin/2to3-2
  /usr/local/bin/2to3

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