fix(local_runtime): Search for libs in sys._base_executable when available.#3178
fix(local_runtime): Search for libs in sys._base_executable when available.#3178aignas merged 3 commits intobazel-contrib:mainfrom
Conversation
Search directory for librarys should look in the same directory as sys._base_executable. Since sys._base_executable may be unset, fallback to sys.executable
But I wonder if this problem manifests when the underlying interpreter can't be found, but the venv is otherwise functional? Maybe if the venv has a copy, not symlink to the interpreter? IIRC, windows venvs create copies of python.exe and rely on pyvenv.cfg to point to the correct pythonhome location. Hm, maybe hardlinks on linux/mac result in something similar? ISTR macs also have some funny tricks they pull with the python executable. In anycase, LGTM |
|
I thought that it was trying to be the realpath of sys.executable, usually: https://github.com/python/cpython/blob/main/Modules/getpath.py But in any event, we may create nested venvs, and sys._base_executable is used to create those nested venvs, so I think that's the appropriate path to use. Also the windows copy thing. |
fix(local_runtime): Search for libs in sys._base_executable when available. (#3178) Search directory for libraries should look in the same directory as sys._base_executable. Since sys._base_executable may be unset, fallback to sys.executable Found this when trying to build using a venv for [tensorstore](https://github.com/google/tensorstore) on Windows: * Github CI uses nuget to download Python. * Build sets up a Python venv. The venv does not include all the lib directories required to link an extension. Fixes #3172 --------- Co-authored-by: Richard Levasseur <[email protected]> --------- Co-authored-by: Laramie Leavitt <[email protected]> Co-authored-by: Richard Levasseur <[email protected]>
Search directory for libraries should look in the same directory as sys._base_executable. Since sys._base_executable may be unset, fallback to sys.executable
Found this when trying to build using a venv for tensorstore on Windows:
The venv does not include all the lib directories required to link an extension.
Fixes #3172