Skip to content

Commit

Permalink
Merge branch 'main' into download-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Khuu authored Nov 12, 2024
2 parents 0c14af5 + 2fcc37c commit 9a0b5fa
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions install/install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,39 @@ set -eou pipefail

# Install required python dependencies for developing
# Dependencies are defined in .pyproject.toml
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE:-python}
if [[ -z ${CONDA_DEFAULT_ENV:-} ]] || [[ ${CONDA_DEFAULT_ENV:-} == "base" ]] || [[ ! -x "$(command -v python)" ]];
if [ -z "${PYTHON_EXECUTABLE:-}" ];
then
PYTHON_EXECUTABLE=python3
if [[ -z ${CONDA_DEFAULT_ENV:-} ]] || [[ ${CONDA_DEFAULT_ENV:-} == "base" ]] || [[ ! -x "$(command -v python)" ]];
then
PYTHON_EXECUTABLE=python3
fi
fi
echo "Using python executable: $PYTHON_EXECUTABLE"

PYTHON_SYS_VERSION="$($PYTHON_EXECUTABLE -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")"
# Check python version. Expect 3.10.x or 3.11.x
printf "import sys\nif sys.version_info.major != 3 or sys.version_info.minor < 10 :\n\tprint('Please use Python >=3.10');sys.exit(1)\n" | $PYTHON_EXECUTABLE
if [[ $? -ne 0 ]]
if ! $PYTHON_EXECUTABLE -c "
import sys
if sys.version_info < (3, 10) or sys.version_info >= (3, 12):
sys.exit(1)
";
then
echo "Python version must be 3.10.x or 3.11.x. Detected version: $PYTHON_SYS_VERSION"
exit 1
fi

if [[ "$PYTHON_EXECUTABLE" == "python" ]];
then
PIP_EXECUTABLE=pip
else
elif [[ "$PYTHON_EXECUTABLE" == "python3" ]];
then
PIP_EXECUTABLE=pip3
else
PIP_EXECUTABLE=pip${PYTHON_SYS_VERSION}
fi

echo "Using pip executable: $PIP_EXECUTABLE"

#
# First install requirements in install/requirements.txt. Older torch may be
# installed from the dependency of other models. It will be overridden by
Expand Down

0 comments on commit 9a0b5fa

Please sign in to comment.