[3.7] bpo-22490: Remove PYVENV_LAUNCHER from environment during launch (GH-9516) by jaraco · Pull Request #19111 · python/cpython (original) (raw)

Thanks for backporting this!

I stumbled accross this issue when I found yet another weird bug caused by __PYVENV_LAUNCHER__, which broke IPython kernels launched from a Jupyter server running in a venv. Because __PYVENV_LAUNCHER__ was polluting the environment when the Python process in the kernel started, include-system-site-packages = false could get picked up from the venv's pyvenv.cfg, which meant that the site-packages dir would get left off of sys.path for that kernel's Python instance.

For reference, which Python version did this first get included in? For me, upgrading from 3.7.6 -> 3.7.9 fixed the above issue.