Skip to content

Commit

Permalink
Update AutoGluon to use UV during setup.sh (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
Innixma authored Nov 2, 2024
1 parent 16091f9 commit 4c4f35d
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions frameworks/AutoGluon/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand All @@ -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"

0 comments on commit 4c4f35d

Please sign in to comment.