On (at least) Amazon Linux, the virtualenv tool configures python with the following sys.path
directories:
''
'${PYTHON_ENV}/local/lib64/python2.7/site-packages'
'${PYTHON_ENV}/local/lib/python2.7/site-packages'
'${PYTHON_ENV}/lib64/python2.7'
'${PYTHON_ENV}/lib/python2.7'
'${PYTHON_ENV}/lib64/python2.7/site-packages'
'${PYTHON_ENV}/lib/python2.7/site-packages'
'${PYTHON_ENV}/lib64/python2.7/lib-dynload'
'${PYTHON_ENV}/local/lib/python2.7/dist-packages'
'${PYTHON_ENV}/local/lib/python2.7/dist-packages'
'${PYTHON_ENV}/lib/python2.7/dist-packages'
'/usr/lib64/python2.7'
'/usr/lib/python2.7'
However, running pip install PyYAML
in that same virtualenv
will install the yaml
module into the ${PYTHON_ENV}/lib64/python2.7/dist-packages
directory, which is not on the search path.
For now, I am working around the problem by creating dist-packages.pth
files as follows:
find ${PYTHON_ENV} -type d -name dist-packages -exec sh -c "echo dist-packages > {}.pth" ';'
I have created a pull-request and issue.
I will also be filing a bug-report against virtualenv
as soon as I create a self-contained script illustrating the problem.