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
{{ message }}
Repository navigation
libpython of a relocated Python is not found, as only sysconfig LIBDIR is looked at #76
With the fix for #54, PythonEnvironment finds the libpython to preload (and to name in the LD_LIBRARY_PATH advice) only through sysconfig.get_config_var('LIBDIR').
A Python whose prefix moved since it was built reports a stale LIBDIR: a python-build-standalone not patched by uv reports /install/lib, and any relocated prefix its old path.
Then nothing is preloaded and no advice is added to the startup error — the same failure as on main before #54.
Possible fix: fall back to sys.base_prefix/lib (and LDLIBRARY / libpython{LDVERSION}.so.1.0) when LIBDIR/INSTSONAME does not exist.
Status of the automated fix run: blocked after 3 review rounds (the cap), on branch issue-76-relocated-libpython (stacked on #78), no PR.
The fix works for the issue's case — a relocated Python whose LIBDIR reports /install/lib gets its libpython preloaded from <sys.base_exec_prefix>/lib, proven end to end on uv CPython 3.10 and 3.13 (the test checks the mapped library in /proc/self/maps) — but the last review found two regressions against #78:
A Python started through a symlinked bin directory (e.g. ln -s <uv-python>/bin a1/bin) reports sys.base_exec_prefix as the compiled-in /install while sys.base_prefix is right; uv's patched build exec_prefix makes it count as relocated, so the remap goes to /install/lib and finds nothing, where Load the libpython of a Python outside the system library directories #78 found LIBDIR as it is.
Direction: try the remapping against sys.base_prefix too, and fall back to LIBDIR as it is when it exists and the build prefix is the same file as a base prefix — or, on Linux, let the probe report the libpython it has actually mapped (/proc/self/maps), which needs no prefix arithmetic at all (not for Debian's statically linked /usr/bin/python3, which maps none; the venv's Python is what is probed, though).
README: the advice for a library not found lost the pointer to the LIBDIR of sysconfig (the startup error names no directory then); keep it, noting it is stale for a moved Python.
Minor: normalize each prefix once; the static half of the "other than its soname" test returns before any lookup; the probe test computes its expectation with the same private sysconfig._get_sysconfigdata_name() expression.
Activity
Find libpython of a relocated Python in the lib directory of its base…
Prefer the library directory moved with the prefix of a relocated Pyt…
Try LIBDIR not under the build prefix as it is, and the prefix's lib …
morisil commentedon Nov 13, 2026
Status of the automated fix run: blocked after 3 review rounds (the cap), on branch
issue-76-relocated-libpython(stacked on #78), no PR.The fix works for the issue's case — a relocated Python whose
LIBDIRreports/install/libgets itslibpythonpreloaded from<sys.base_exec_prefix>/lib, proven end to end on uv CPython 3.10 and 3.13 (the test checks the mapped library in/proc/self/maps) — but the last review found two regressions against #78:bindirectory (e.g.ln -s <uv-python>/bin a1/bin) reportssys.base_exec_prefixas the compiled-in/installwhilesys.base_prefixis right; uv's patched buildexec_prefixmakes it count as relocated, so the remap goes to/install/liband finds nothing, where Load the libpython of a Python outside the system library directories #78 foundLIBDIRas it is.Direction: try the remapping against
sys.base_prefixtoo, and fall back toLIBDIRas it is when it exists and the build prefix is the same file as a base prefix — or, on Linux, let the probe report the libpython it has actually mapped (/proc/self/maps), which needs no prefix arithmetic at all (not for Debian's statically linked/usr/bin/python3, which maps none; the venv's Python is what is probed, though).LIBDIRofsysconfig(the startup error names no directory then); keep it, noting it is stale for a moved Python.Minor: normalize each prefix once; the static half of the "other than its soname" test returns before any lookup; the probe test computes its expectation with the same private
sysconfig._get_sysconfigdata_name()expression.