Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Extras folder not correctly added to sys.path on OS X #514

Open
samizdatco opened this Issue · 1 comment

2 participants

@samizdatco

Creating a new virtualenv results in an entry for the system Extras directory being added to sys.path, but with the wrong prefix:

$ virtualenv /opt/venv
$ /opt/venv/bin/python -c 'import pprint,sys;pprint.pprint(sys.path)'
['',
 '/opt/venv/lib/python27.zip',
 '/opt/venv/lib/python2.7',
 '/opt/venv/lib/python2.7/plat-darwin',
 '/opt/venv/lib/python2.7/plat-mac',
 '/opt/venv/lib/python2.7/plat-mac/lib-scriptpackages',
 '/opt/venv/Extras/lib/python',
 '/opt/venv/lib/python2.7/lib-tk',
 '/opt/venv/lib/python2.7/lib-old',
 '/opt/venv/lib/python2.7/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/opt/venv/lib/python2.7/site-packages']

Note that it's looking for the path Extras/lib/python within the venv even though this path doesn't exist. The system-wide Extras directory can be found (on 10.9 anyway, not sure how far back this placement goes) at:

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

For reference, system python's default path looks like:

$ /usr/bin/python -c 'import pprint,sys;pprint.pprint(sys.path)'
['',
 '/Library/Python/2.7/site-packages/virtualenv-1.10.1-py2.7.egg',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
 '/Library/Python/2.7/site-packages']
@STAbraham

Running into the same issue. As a result, virtualenv python doesn't have access to all the modules that came a long with the system-wide python installation, like numpy. Is this the expected behavior, suggesting that we need to download/copy modules from the Extras path as needed. For reference, I'm using OS X 10.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.