Description
Using virtualenv on CentOS 6.5 with a custom python 2.7.6 build uses the wrong 'site.py' module. I used the following to build python on CentOS:
# Python 2.7.6:
wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
No problems with the python build. If I don't use virtualenv everything works. The modules are stored in '/usr/local/lib/python2.7'. I can do the following:
import site
site.getsitepackages()
It will print the list of package directories as expected. If I create a virtual environment:
virtualenv -p python2.7 py27
and then try the same code above, I get a failure on the function ".getsitepackage()". I can see in the virtualenv lib directory that the "site.py" is not a symlink to "/usr/local/lib/python2.7/site.py", but a copy of some other site.py module. If I go to the virtualenv lib directory and remove this site.py and create the following symlinks it will work and my env is no longer broken:
ln -s /usr/local/lib/python2.7/site.py
ln -s /usr/local/lib/python2.7/traceback.py
ln -s /usr/local/lib/python2.7/sysconfig.py
ln -s /usr/local/lib/python2.7/_sysconfigdata.py
EDIT:
It seems that it is missing far more links than just these four in my environment. I'm not sure how it decides what to link and what not to link. It doesn't appear to be as simple as changing a few symlinks. The basic issue is still here though, I can't use the 2.7.x site.py additions because the version included with virtualenv overrides it.
This is using virtualenv 1.11.4, using python 2.7.6 on CentOS 6.5.