Flaviu Simihaian's Blog - Entrepreneur and Developer

Problems With Easy_install

I work on OS X 10.6, which makes package management much more of a challenge than any Linux distro.

Sure, I’ve tried MacPorts, homebrew, and even fink. None makes it as easy as apt-get, though I recommend homebrew.

Anyway, I joyfully start a new python project in a clean virtual environment with virtualenv and it’s companion, virtualenvwrapper (not sure why these are not part of the same project).

I specify the –no-site-packages to make sure I don’t get system packages in my virtualenv (not sure why this is not the default), like so:

1
mkvirtualenv --no-site-packages happy_virtual_env

But then it turns out I still have access to system wide packages, like django. Hmm…

…insert some 20 hours of modifying the Python Path and getting errors like:

1
2
UserWarning: Module pkg_resources was already imported from
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py

or

1
pkg_resources.DistributionNotFound: setuptools==0.6c9

…saddened, I finally “sudo rm -rf” pkg_resources.py, setuptools, pip, virtualenv, virtualenvwrapper, from both /Library/Python/2.6/site-packages/ and /usr/local/bin/

Then I manually installed setuptools (see here) and then “easy_install pip”, “pip install virtualenv”, and now it all works as expected.

So, while I wish I knew more about package management, “nuke and pave” is sometimes ok.

Comments

Fork Flaviu on GitHub