From 4c4f35dd04d2f94755e62d6d73877fff4077a4ab Mon Sep 17 00:00:00 2001 From: Nick Erickson Date: Sat, 2 Nov 2024 14:11:30 -0700 Subject: [PATCH] Update AutoGluon to use UV during setup.sh (#643) --- frameworks/AutoGluon/setup.sh | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/frameworks/AutoGluon/setup.sh b/frameworks/AutoGluon/setup.sh index 6980b6353..5d4a4b5fc 100755 --- a/frameworks/AutoGluon/setup.sh +++ b/frameworks/AutoGluon/setup.sh @@ -3,6 +3,9 @@ # exit when any command fails set -e +# Uncomment for debugging installation +# set -x + HERE=$(dirname "$0") VERSION=${1:-"stable"} REPO=${2:-"https://github.com/autogluon/autogluon.git"} @@ -14,30 +17,39 @@ fi # creating local venv . ${HERE}/../shared/setup.sh ${HERE} true -# Below fixes seg fault on MacOS due to bug in libomp: https://github.com/awslabs/autogluon/issues/1442 +# aka "{xyz}/automlbenchmark/frameworks/AutoGluon/venv/bin/python" +PY_EXEC_NO_ARGS="$(cut -d' ' -f1 <<<"$py_exec")" + +# Below fixes seg fault on MacOS due to bug in libomp: https://github.com/autogluon/autogluon/issues/1442 if [[ -x "$(command -v brew)" ]]; then wget https://raw.githubusercontent.com/Homebrew/homebrew-core/fb8323f2b170bd4ae97e1bac9bf3e2983af3fdb0/Formula/libomp.rb -P "${HERE}/lib" brew install "${HERE}/lib/libomp.rb" fi PIP install --upgrade pip -PIP install --upgrade setuptools wheel + +PIP install uv +UV="${PY_EXEC_NO_ARGS} -m uv" if [[ "$VERSION" == "stable" ]]; then - PIP install --no-cache-dir -U "${PKG}" - PIP install --no-cache-dir -U "${PKG}.tabular[skex]" + $UV pip install --no-cache-dir -U "${PKG}" + $UV pip install --no-cache-dir -U "${PKG}.tabular[skex]" elif [[ "$VERSION" =~ ^[0-9] ]]; then - PIP install --no-cache-dir -U "${PKG}==${VERSION}" - PIP install --no-cache-dir -U "${PKG}.tabular[skex]==${VERSION}" + $UV pip install --no-cache-dir -U "${PKG}==${VERSION}" + $UV pip install --no-cache-dir -U "${PKG}.tabular[skex]==${VERSION}" else TARGET_DIR="${HERE}/lib/${PKG}" rm -Rf ${TARGET_DIR} git clone --depth 1 --single-branch --branch ${VERSION} --recurse-submodules ${REPO} ${TARGET_DIR} cd ${TARGET_DIR} - PY_EXEC_NO_ARGS="$(cut -d' ' -f1 <<<"$py_exec")" PY_EXEC_DIR=$(dirname "$PY_EXEC_NO_ARGS") - env PATH="$PY_EXEC_DIR:$PATH" bash -c ./full_install.sh - PIP install -e tabular/[skex] + + # Install in non-editable mode to avoid interaction with other pre-existing AutoGluon installations + env PATH="$PY_EXEC_DIR:$PATH" bash -c "./full_install.sh --non-editable" + $UV pip install tabular/[skex] fi +# Note: `setuptools` being present in the venv will cause torch==1.4.x to raise an exception for an unknown reason in AMLB. +echo "Finished setup, testing autogluon install..." + PY -c "from autogluon.tabular.version import __version__; print(__version__)" >> "${HERE}/.setup/installed"