@@ -266,6 +266,8 @@ IF(RV_TARGET_WINDOWS)
266266 # for pybind11 v2.13.6+ which has stricter Python library detection.
267267 # Note: pybind11's FindPythonLibsNew.cmake uses PYTHON_LIBRARY (all caps),
268268 # PYTHON_INCLUDE_DIR, and PYTHON_EXECUTABLE variables.
269+ # --no-cache-dir: Don't use pip's wheel cache (prevents using wheels built for wrong Python version)
270+ # --force-reinstall: Reinstall packages even if already installed (ensures fresh build)
269271
270272 IF (CMAKE_BUILD_TYPE MATCHES "^Debug$" )
271273 # For Debug builds, we need to tell OpenTimelineIO to build in debug mode
@@ -274,18 +276,26 @@ IF(RV_TARGET_WINDOWS)
274276 ${CMAKE_COMMAND} -E env
275277 "OTIO_CXX_DEBUG_BUILD=1"
276278 "CMAKE_ARGS=-DPYTHON_LIBRARY=${_python3_implib} -DPYTHON_INCLUDE_DIR=${_include_dir} -DPYTHON_EXECUTABLE=${_python3_executable} "
277- "${_python3_executable} " -m pip install --upgrade -r "${_requirements_output_file} "
279+ "${_python3_executable} " -m pip install --upgrade -- no - cache -dir --force-reinstall - r "${_requirements_output_file} "
278280 )
279281 ELSE ()
280282 SET (_requirements_install_command
281283 ${CMAKE_COMMAND} -E env
282284 "CMAKE_ARGS=-DPYTHON_LIBRARY=${_python3_implib} -DPYTHON_INCLUDE_DIR=${_include_dir} -DPYTHON_EXECUTABLE=${_python3_executable} "
283- "${_python3_executable} " -m pip install --upgrade -r "${_requirements_output_file} "
285+ "${_python3_executable} " -m pip install --upgrade -- no - cache -dir --force-reinstall - r "${_requirements_output_file} "
284286 )
285287 ENDIF ()
286288ELSE ()
289+ # On macOS and Linux, force pip to build OpenTimelineIO from source and avoid using
290+ # cached wheels that may have been built for a different Python version.
291+ # This ensures ABI compatibility with our custom-built Python.
292+ # --no-cache-dir: Don't use pip's wheel cache (prevents using wheels built for wrong Python version)
293+ # --force-reinstall: Reinstall packages even if already installed (ensures fresh build)
294+ # CMAKE_ARGS: Tell OTIO's CMake build which Python to use (prevents it from finding system Python via pyenv/etc)
287295 SET (_requirements_install_command
288- "${_python3_executable} " -m pip install --upgrade -r "${_requirements_output_file} "
296+ ${CMAKE_COMMAND} -E env
297+ "CMAKE_ARGS=-DPYTHON_EXECUTABLE=${_python3_executable} "
298+ "${_python3_executable} " -m pip install --upgrade --no -cache -dir --force-reinstall -r "${_requirements_output_file} "
289299 )
290300ENDIF ()
291301
0 commit comments