Open ncoghlan opened 1 month ago
I'm not sure what, if anything, pip-sync
should change here. It may make the most sense to just document the status quo more clearly.
Alternatively, pip-sync
could accepts its own -I
option to indicate that python_executable
should be invoked with the -I
option.
+1 on at least documenting this. I'm also fine with adding a specific option, but it'd require someone to step up.
Running
pip-sync
with--python-executable
, I was baffled as to why it was attempting to remove items from the local directory (any environment) and the user site directory (python-build-standalone environments with no virtual env present).I eventually realised it was due to the following problem: even though
pip-sync
was being executed from a Python runtime configured to use isolated mode (no implied sys.path[0], no user site directory), the same was not true whenpip-sync
invoked the given Python executable to check the value ofsys.path
.This means actually performing the sync in an isolated environment requires setting the relevant Python environment variables rather relying than solely on the
-I
command line flag: