This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: by default, a virtual environment is *not* isolated from the system-level site-packages directories
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: cheryl.sabella, docs@python, meribold, vinay.sajip
Priority: normal Keywords: patch

Created on 2018-05-10 14:57 by meribold, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6755 merged meribold, 2018-05-10 15:30
Messages (2)
msg316367 - (view) Author: Lukas Waymann (meribold) * Date: 2018-05-10 14:57
PEP 405 says this:

> By default, a virtual environment is entirely isolated from the system-level site-packages directories.
> If the pyvenv.cfg file also contains a key include-system-site-packages with a value of true (not case sensitive), the site module will also add the system site directories to sys.path after the virtual environment site directories.

The documentation of the site module ( says (emphasis added):

> If pyvenv.cfg […] contains the key include-system-site-packages set to anything other than false (case-insensitive), the system-level prefixes will still also be searched for site-packages; *otherwise they won’t*.

However, what actually happens in is different: see <>.  The system_site variable is initialized to "true" and doesn't change unless the key include-system-site-packages exists in pyvenv.cfg.

I think system_site should be initialized to "false" and the condition in line 468 should be `if system_site.lower() != "false"`.
msg339711 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2019-04-09 07:27
New changeset c324c748871804f31f56b3bd02a8650b3bf1bae7 by Vinay Sajip (Lukas Waymann) in branch 'master':
bpo-33456: site module documentation - fix wrong default for key in pyvenv.cfg (GH-6755)
Date User Action Args
2022-04-11 14:59:00adminsetgithub: 77637
2019-04-09 07:30:51vinay.sajipsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-04-09 07:27:40vinay.sajipsetmessages: + msg339711
2019-04-08 21:48:35cheryl.sabellasetnosy: + vinay.sajip, cheryl.sabella, docs@python

assignee: docs@python
components: + Documentation, - Library (Lib)
versions: - Python 3.6
2018-05-10 15:30:46meriboldsetkeywords: + patch
stage: patch review
pull_requests: + pull_request6442
2018-05-10 14:57:34meriboldcreate