You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee=Noneclosed_at=<Date2019-02-04.15:23:13.377>created_at=<Date2019-02-01.09:03:04.786>labels= ['3.7', 'type-bug', 'library', 'OS-windows']
title='Controlling venv from venv no longer works in 3.7.2'updated_at=<Date2019-02-04.15:23:13.377>user='https://github.com/schlamar'
Controlling a venv from the python.exe from another venv does not work since 3.7.2 on Windows. This is probably related to the change
bpo-34977: venv on Windows will now use a python.exe redirector rather than copying the actual binaries from the base environment.
This is obviously related to bpo-35872, but this could be a different bug.
When a Python script in a venv wants to control another venv by running commands like another-venv\python.exe -m pip with subprocess, python.exe is not referencing the other venv. It is referencing to the venv the script currently running from. This is probably because os.environ contains a 'PYVENV_LAUNCHER' which is pointing to the venv from the script.
So with the fix for multiprocessing, we currently rely on __PYVENV_LAUNCHER__ remaining set throughout the process.
However, it may be better to add a "sys.base_executable" property instead and clear the __PYVENV_LAUNCHER__ variable once we've read it. Then we can set it again in multiprocessing and launch the base executable, and otherwise default to launching the redirector.