Broken Python homepage in virtualenv

I recently launched (OS X 10.6.8) brew update and brew upgrade and am working in virtualenv, which now fails. I tried:

 $ brew unlink python && brew link python Unlinking /usr/local/Cellar/python/2.7.8_1... 38 symlinks removed Linking /usr/local/Cellar/python/2.7.8_1... 35 symlinks created 

But in virtualenv, I still get the following:

 $ python --version dyld: Library not loaded: @executable_path/../.Python Referenced from: /Users/admin/.virtualenvs/saves/bin/python Reason: image not found Trace/BPT trap 

I found another post about this, but the solution still seems unclear. I was in a hurry, so I uninstalled the Python version and ran brew doctor , which returned the error above as a warning:

 sh: line 1: 40991 Trace/BPT trap python -V 2>&1 

Then brew install python . Still getting the above error in virtualenv.

Related questions and a debugging message are not final:

Broken links in Virtualenvs
dyld-library-loaded-executable_path-python

Update

Creating a new virtualenv solved this specific problem.

+7
python homebrew virtualenv
source share
1 answer

I will put my comment as an answer, for clarity for future visitors with the same problem.

The linked links you pointed out exactly indicate what the problem is: since virtualenv creates symbolic links to files, and homebrew replaces these files when updating with other files with names, you get broken links. Both linked links give recommendations on how to solve this: one to create a new virtualenv, the other to fix broken links.

In general, although Python is being updated again in homebrew, you may find yourself in the same situation.

This was apparently implemented by virtualenv developers , and there is the --always-copy option to avoid such problems:

 $ virtualenv --help Usage: virtualenv-3.4 [OPTIONS] DEST_DIR Options: ... --always-copy Always copy files rather than symlinking. ... 

This should prevent problems when upgrading Python via Homebrew in the future. Although then, of course, your virtualenv will have an older version of Python. Which sometimes can be exactly what you want.

+12
source share

All Articles