Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

site.getsitepackages() doesn't respect --system-site-packages on python2 #2106

Closed
freundTech opened this issue May 4, 2021 · 2 comments · Fixed by #2107
Closed

site.getsitepackages() doesn't respect --system-site-packages on python2 #2106

freundTech opened this issue May 4, 2021 · 2 comments · Fixed by #2107
Labels

Comments

@freundTech
Copy link
Contributor

Issue

site.getsitepackages() doesn't respect --system-site-packages being set on python2. System site-package paths are never included.
I came across this while working on #2105. In contrast to #2105 this is not specific to debian, which is why I am creating a separate issue for it.

python -m virtualenv --system-site-packages -ppython2 testenv
. testenv/bin/activate
python -c "import site; print(site.getsitepackages())"
['/home/adrian/Documents/dev/uni/bachelor/mypy/testenv/lib/python2.7/site-packages', '/home/adrian/Documents/dev/uni/bachelor/mypy/testenv/lib/site-python']

Environment

Provide at least:

  • OS: Tested on both Ubuntu 18.04.3 LTS and Arch Linux
  • pip list of the host python where virtualenv is installed:

Same as #2105

Output of the virtual environment creation

Make sure to run the creation with -vvv --with-traceback:
Same as #2105

@c0d3h4x0r
Copy link

This is still broken for my use case in virtualenv==20.4.6 w/ python 2.7.16 (at least on Windows).

site.getsitepackages() does not contain the system site packages locations when specifically called from within sitecustomize.py.

@c0d3h4x0r
Copy link

It appears to me that this ordering is wrong:

load_host_site() if global_site_package_enabled: add_global_site_package()

I'm guessing that add_global_site_package() really should be called before load_host_site().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants