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.py does not include recent code to support venv #1421

Closed
pfmoore opened this issue Oct 4, 2019 · 5 comments
Closed

site.py does not include recent code to support venv #1421

pfmoore opened this issue Oct 4, 2019 · 5 comments

Comments

@pfmoore
Copy link
Member

pfmoore commented Oct 4, 2019

See https://bugs.python.org/issue38369 for details, but basically the site.py file shipped with virtualenv does not include code to support Python 3 venv environments. In practical terms, this means that if you create a venv using python -m venv xxx from within a virtualenv, then (1) pip is not properly installed into the venv, and (2) the venv can see the parent virtualenv's site-packages.

I doubt this is fixable in any practical sense with "traditional" virtualenv - the need to retain 2.7 compatibility, along with the complexity of trying to backport the venv support code manually, means that this is probably not worthwhile for an edge case like this. Creating virtual environments from within one another is dangerous at best and unsupported in general, so "don't do that" is probably the only reasonable answer. It is annoying that the problem manifests itself with a silently broken environment, rather than a clean error message, but I don't think there's much that can be done about that (core Python is unlikely to add special support for a 3rd party library, and I'm not sure an error could be added from the virtualenv side).

Hopefully #1377 will be able to handle this more cleanly - if nothing else, it is an edge case that should be considered in that work.

@gaborbernat
Copy link
Contributor

Yeah, #1377 will fix this.

@Julian
Copy link

Julian commented Dec 11, 2019

(2) there is quite surprising and took me a bit to track down the root cause (and find this issue).

Maybe renaming this issue to "Virtualenvs created with virtualenv.py have -m venv modules that leak their site-packages" makes it more likely to be found by end users. (Might not matter though I guess -- #1377 also is now closed, so is there a better place to track progress besides watching the feature branch or not quite yet?)

@gaborbernat
Copy link
Contributor

@Julian nothing better than watch the feature branch on this repository yet; will try to make some progress then this, but my free time I can spend on this is sadly limited.

@Julian
Copy link

Julian commented Dec 11, 2019 via email

@gaborbernat
Copy link
Contributor

This will be fixed by the rewrite, where the progress can be tracked by https://github.com/pypa/virtualenv/milestone/7

@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants