Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Virtualenv always using sytem site packages with macos 10.6 system python #369

Open
brickZA opened this Issue · 4 comments

3 participants

@brickZA

Creating a fresh virtualenv with either --system-site-packages or --no-site-packages results in the system site-packages being available in the venv. Furthermore, installing new packages don't override the system pacakges unless -e is used. Example:

ofaletses-MacBook-Pro:~ ofaletse$ virtualenv --no-site-packages test_venv/
New python executable in test_venv/bin/python
Installing setuptools............done.
Installing pip...............done.
ofaletses-MacBook-Pro:~ ofaletse$ source test_venv/bin/activate
(test_venv)ofaletses-MacBook-Pro:~ ofaletse$ python -c 'import blinker ; print blinker.__version__'
1.2
(test_venv)ofaletses-MacBook-Pro:~ ofaletse$ # System installed version, should not be visible
(test_venv)ofaletses-MacBook-Pro:~ ofaletse$ pip install blinker==1.0
Downloading/unpacking blinker==1.0
Downloading blinker-1.0.tar.gz (61kB): 61kB downloaded
Running setup.py egg_info for package blinker
Installing collected packages: blinker
Found existing installation: blinker 1.2
Not uninstalling blinker at /Library/Python/2.6/site-packages, outside environment /Users/ofaletse/test_venv/bin/..
Running setup.py install for blinker
Successfully installed blinker
Cleaning up...
(test_venv)ofaletses-MacBook-Pro:~ ofaletse$ python -c 'import blinker ; print blinker.__version__'
1.2
(test_venv)ofaletses-MacBook-Pro:~ ofaletse$ # Still using system package
(test_venv)ofaletses-MacBook-Pro:~ ofaletse$ ls test_venv/lib/python2.6/site-packages/
blinker easy-install.pth setuptools-0.6c11-py2.6.egg
blinker-1.0-py2.6.egg-info pip-1.2.1-py2.6.egg setuptools.pth
(test_venv)ofaletses-MacBook-Pro:~ ofaletse$ # although blinker does seem to be installed in the virtualenv
(test_venv)ofaletses-MacBook-Pro:~ ofaletse$

Full version of MacOS: 10.6.8 (Snow Leopard), using system installed python2.6

@chaoflow

@brickZA: Could you post the output of the following? It might help to track things down.

$ virtualenv --system-site-packages with-site
$ ./with-site/bin/python -c 'import pprint,sys;pprint.pprint(sys.path)'
$ virtualenv --no-site-packages without-site
$ ./without-site/bin/python -c 'import pprint,sys;pprint.pprint(sys.path)'
@brickZA

Hi,

We get the following:

ofaletses-MacBook-Pro:~ ofaletse$ virtualenv --system-site-packages with-site
New python executable in with-site/bin/python
Installing setuptools.............done.
Installing pip...............done.

ofaletses-MacBook-Pro:~ ofaletse$ ./with-site/bin/python -c 'import pprint,sys;pprint.pprint(sys.path)'
['',
 '/Users/ofaletse/with-site/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
 '/Users/ofaletse/with-site/lib/python2.6/site-packages/pip-1.2.1-py2.6.egg',
 '/Library/Python/2.6/site-packages',
 '/Library/Python/2.6/site-packages/pip-1.2.1-py2.6.egg',
 '/Users/ofaletse',
 '/Users/ofaletse/with-site/lib/python26.zip',
 '/Users/ofaletse/with-site/lib/python2.6',
 '/Users/ofaletse/with-site/lib/python2.6/plat-darwin',
 '/Users/ofaletse/with-site/lib/python2.6/plat-mac',
 '/Users/ofaletse/with-site/lib/python2.6/plat-mac/lib-scriptpackages',
 '/Users/ofaletse/with-site/Extras/lib/python',
 '/Users/ofaletse/with-site/lib/python2.6/lib-tk',
 '/Users/ofaletse/with-site/lib/python2.6/lib-old',
 '/Users/ofaletse/with-site/lib/python2.6/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
 '/Users/ofaletse/with-site/lib/python2.6/site-packages',
 '/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg-info',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode',
 '/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg-info']

ofaletses-MacBook-Pro:~ ofaletse$ virtualenv --no-site-packages without-site
New python executable in without-site/bin/python
Installing setuptools.............done.
Installing pip...............done.

ofaletses-MacBook-Pro:~ ofaletse$ ./without-site/bin/python -c 'import pprint,sys;pprint.pprint(sys.path)'
['',
 '/Library/Python/2.6/site-packages/pip-1.2.1-py2.6.egg',
 '/Users/ofaletse/without-site/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
 '/Users/ofaletse/without-site/lib/python2.6/site-packages/pip-1.2.1-py2.6.egg',
 '/Library/Python/2.6/site-packages',
 '/Users/ofaletse',
 '/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg-info',
 '/Users/ofaletse/without-site/lib/python26.zip',
 '/Users/ofaletse/without-site/lib/python2.6',
 '/Users/ofaletse/without-site/lib/python2.6/plat-darwin',
 '/Users/ofaletse/without-site/lib/python2.6/plat-mac',
 '/Users/ofaletse/without-site/lib/python2.6/plat-mac/lib-scriptpackages',
 '/Users/ofaletse/without-site/Extras/lib/python',
 '/Users/ofaletse/without-site/lib/python2.6/lib-tk',
 '/Users/ofaletse/without-site/lib/python2.6/lib-old',
 '/Users/ofaletse/without-site/lib/python2.6/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
 '/Users/ofaletse/without-site/lib/python2.6/site-packages']
@ekem

Also seeing this same behavior in Debian Jessie

@ekem
ekem@calcium:~/venv$ virtualenv --system-site-packages ~/venv/with-site
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/ekem/venv/with-site/bin/python2
Also creating executable in /home/ekem/venv/with-site/bin/python
Installing setuptools, pip...done.
ekem@calcium:~/venv$ ./with-site/bin/python -c 'import pprint,sys;pprint.pprint(sys.path)'
['',
 '/mnt/storage/virtualenv/with-site/lib/python2.7',
 '/mnt/storage/virtualenv/with-site/lib/python2.7/plat-x86_64-linux-gnu',
 '/mnt/storage/virtualenv/with-site/lib/python2.7/lib-tk',
 '/mnt/storage/virtualenv/with-site/lib/python2.7/lib-old',
 '/mnt/storage/virtualenv/with-site/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/mnt/storage/virtualenv/with-site/local/lib/python2.7/site-packages',
 '/mnt/storage/virtualenv/with-site/lib/python2.7/site-packages',
 '/usr/local/lib/python2.7/dist-packages/nltk-3.0a3-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/PyYAML-3.11-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/yolk-0.4.3-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/PyYAML-3.11-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/yolk-0.4.3-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/pymodules/python2.7']
ekem@calcium:~/venv$ virtualenv --no-site-packages ~/venv/without-siteRunning virtualenv with interpreter /usr/bin/python2
New python executable in /home/ekem/venv/without-site/bin/python2
Also creating executable in /home/ekem/venv/without-site/bin/python
Installing setuptools, pip...done.
ekem@calcium:~/venv$ ./without-site/bin/python -c 'import pprint,sys;pprint.pprint(sys.path)'
['',
 '/mnt/storage/virtualenv/without-site/lib/python2.7',
 '/mnt/storage/virtualenv/without-site/lib/python2.7/plat-x86_64-linux-gnu',
 '/mnt/storage/virtualenv/without-site/lib/python2.7/lib-tk',
 '/mnt/storage/virtualenv/without-site/lib/python2.7/lib-old',
 '/mnt/storage/virtualenv/without-site/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/mnt/storage/virtualenv/without-site/local/lib/python2.7/site-packages',
 '/mnt/storage/virtualenv/without-site/lib/python2.7/site-packages']
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.