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
PY_SITE_PACKAGES_PATH ignores CMAKE_INSTALL_PREFIX, so Python install fails outside a venv #6931
PY_SITE_PACKAGES_PATH defaults to the found interpreter's platlib regardless of CMAKE_INSTALL_PREFIX, so ninja install with ITK_WRAP_PYTHON=ON writes the bindings outside the prefix and fails with "Permission denied" on a system Python (seen on Windows with Python 3.14 under C:/Program Files, #6891). The prefix mismatch is detected at configure but only reported as an install-time WARNING.
Current behavior
Wrapping/Generators/Python/CMakeLists.txt:38-79:
sysconfig.get_path('platlib') is stored once as a CACHE STRING; a later change of CMAKE_INSTALL_PREFIX does not recompute it.
When CMAKE_INSTALL_PREFIX != sys.prefix, an install(CODE ...) prints a warning, then the install proceeds into the interpreter's site-packages anyway.
The failure surfaces at the first bindings file (itkConfig.py), after the C++ install has completed.
Proposed changes
When the prefixes differ, default to the prefix-relative location, ${CMAKE_INSTALL_PREFIX}/<platlib relative to sys.prefix> (e.g. lib/python3.14/site-packages, Lib/site-packages on Windows), and keep the interpreter's platlib only when CMAKE_INSTALL_PREFIX equals sys.prefix (venv, conda, pixi).
Report the decision at configure time with message(STATUS), and replace the install-time WARNING with a configure-time one that names the variable to set.
Check writability of the chosen directory at configure time when it already exists, so the failure is reported before a long build.
Add a CI check that installs with ITK_WRAP_PYTHON=ON into a scratch prefix whose Python is the system interpreter, so the install path is exercised outside a venv.
Item 1 changes where every non-venv Python build installs, so it needs a release note; builds inside a venv, conda, or pixi environment are unaffected.
Activity