From e643a78858e9d588b3a3112a0fb4a0f8744049ff Mon Sep 17 00:00:00 2001 From: Dillon DuPont Date: Thu, 5 Jun 2025 12:07:38 -0400 Subject: [PATCH] Enforced py3.11 on playground.sh, conditional macOS installs for Intel --- scripts/playground.sh | 50 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/scripts/playground.sh b/scripts/playground.sh index d36d4748..4cdb1ffa 100755 --- a/scripts/playground.sh +++ b/scripts/playground.sh @@ -146,26 +146,54 @@ echo "šŸ Setting up Python environment..." PYTHON_CMD="" for cmd in python3.11 python3 python; do if command -v $cmd &> /dev/null; then - # Check if this Python version is 3.11+ + # Check this Python version PYTHON_VERSION=$($cmd --version 2>&1 | cut -d" " -f2) PYTHON_MAJOR=$(echo $PYTHON_VERSION | cut -d. -f1) PYTHON_MINOR=$(echo $PYTHON_VERSION | cut -d. -f2) - if [ "$PYTHON_MAJOR" -gt 3 ] || ([ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -ge 11 ]); then + if [ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -eq 11 ]; then PYTHON_CMD=$cmd echo "āœ… Found suitable Python: $cmd (version $PYTHON_VERSION)" break + elif [ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -gt 11 ]; then + PYTHON_CMD=$cmd + PYTHON_TOO_NEW=true + echo "āš ļø Found $cmd (version $PYTHON_VERSION) but only Python 3.11.x is supported." + break else echo "āš ļø Found $cmd (version $PYTHON_VERSION) but it's too old, trying next..." fi fi done -# If no suitable Python was found, error out -if [ -z "$PYTHON_CMD" ]; then - echo "āŒ Python 3.11+ is required but not found." - echo "Please install Python 3.11+ and try again." - exit 1 +# If no suitable Python was found, or if Python is too new, offer to exit or continue +if [ -z "$PYTHON_CMD" ] || [ "$PYTHON_TOO_NEW" = true ]; then + OS_TYPE=$(uname -s) + if [ "$PYTHON_TOO_NEW" = true ]; then + echo -e "\nāŒ Python version $PYTHON_VERSION detected. Only Python 3.11.x is supported. Newer versions (e.g., 3.12+) are not yet supported." + else + if [[ "$OS_TYPE" == "Darwin" ]]; then + echo -e "\nāŒ python3.11 not found. To continue, we recommend running this:\n\n $ brew install python@3.11\n" + elif [[ "$OS_TYPE" == "MINGW"* || "$OS_TYPE" == "CYGWIN"* || "$OS_TYPE" == "MSYS"* ]]; then + echo -e "\nāŒ python3.11 not found. Please install Python 3.11 from https://www.python.org/downloads/\n" + else + echo -e "\nāŒ python3.11 not found. Please install Python 3.11 from your package manager or https://www.python.org/downloads/\n" + fi + fi + while true; do + echo "Would you like to exit so you can install Python 3.11, or continue anyway? (e = exit, c = continue): " + read -n 1 -r PYTHON_CONT_CHOICE + echo + if [[ "$PYTHON_CONT_CHOICE" =~ ^[Ee]$ ]]; then + echo "Exiting so you can install Python 3.11." + exit 1 + elif [[ "$PYTHON_CONT_CHOICE" =~ ^[Cc]$ ]]; then + echo "āš ļø Continuing without Python 3.11. Some features may not work as expected." + break + else + echo "Please enter 'e' to exit or 'c' to continue." + fi + done fi # Create a virtual environment @@ -181,8 +209,12 @@ echo "šŸ“¦ Updating C/ua packages..." pip install -U pip setuptools wheel Cmake pip install -U cua-computer "cua-agent[all]" -# Temporary fix for mlx-vlm, see https://github.com/Blaizzy/mlx-vlm/pull/349 -pip install git+https://github.com/ddupont808/mlx-vlm.git@stable/fix/qwen2-position-id +# Install mlx-vlm on Apple Silicon Macs +if [[ $(uname -m) == 'arm64' ]]; then + echo "Installing mlx-vlm for Apple Silicon Macs..." + pip install git+https://github.com/Blaizzy/mlx-vlm.git + # pip install git+https://github.com/ddupont808/mlx-vlm.git@stable/fix/qwen2-position-id +fi # Create a simple demo script mkdir -p "$DEMO_DIR"