From dc475a0e904ff7cbf24881891fd85a819c019dcb Mon Sep 17 00:00:00 2001 From: Ivan Date: Thu, 16 Apr 2026 03:37:07 -0500 Subject: [PATCH] fix(android): ensure compatibility of virtual environment by linking python3 to python if necessary --- scripts/build-android-wheels-local.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/build-android-wheels-local.sh b/scripts/build-android-wheels-local.sh index a3ff3bc..2dddf0f 100755 --- a/scripts/build-android-wheels-local.sh +++ b/scripts/build-android-wheels-local.sh @@ -178,7 +178,13 @@ popd >/dev/null PYPIDIR="${CHAQUOPY_DIR}/server/pypi" VENV_DIR="${PYPIDIR}/.venv-local" +rm -rf "${VENV_DIR}" "${PYTHON_BIN}" -m venv "${VENV_DIR}" +# Some Python images only provide python3/python3.X in venv bin, while the +# script below invokes `${VENV_DIR}/bin/python`. +if [[ ! -e "${VENV_DIR}/bin/python" && -e "${VENV_DIR}/bin/python3" ]]; then + ln -sf python3 "${VENV_DIR}/bin/python" +fi "${VENV_DIR}/bin/pip" install --upgrade pip "${VENV_DIR}/bin/pip" install -r "${PYPIDIR}/requirements.txt" "${VENV_DIR}/bin/pip" install "numpy==${NUMPY_VERSION}"