Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
fix(install): detect x86_64 Python venv on Apple Silicon and rebuild as arm64
Ramakrishna Bachu70394e1f85cf
diff --git a/install.sh b/install.shindex f0af60e2d60..532203a51af 100755--- a/install.sh+++ b/install.sh@@ -1530,17 +1530,51 @@ if [ -x "$VENV_DIR/bin/python" ]; then: > "$VENV_DIR/.unsloth-studio-owned" 2>/dev/null || truefi-# Guard against Python 3.13.8 torch import bug on Apple Silicon-# (skip when the user explicitly chose a version via --python)+# Guard against two independent Apple Silicon venv problems, in order:+# 1. uv may create the venv from a cached x86_64 (Rosetta) Python when a+# same-version x86_64 build is already cached (often because uv itself+# is an x86_64 build). That venv reports x86_64 to wheel resolvers, and+# PyTorch ships no macOS wheels on the CPU index for any architecture,+# so the torch install can never resolve. Recreate it with an+# arch-explicit arm64 CPython.+# 2. Python 3.13.8 has a known torch import bug.+# The two are independent: a venv may be x86_64 and, once recreated, still+# land on 3.13.8. So we re-inspect the interpreter between the checks instead+# of chaining them with elif, guaranteeing both invariants hold on whatever+# venv we end up with. Skip both when the user explicitly chose an interpreter+# via --python.if [ -z "$_USER_PYTHON" ] && [ "$OS" = "macos" ] && [ "$_ARCH" = "arm64" ]; then- _PY_VER=$("$VENV_DIR/bin/python" -c \- "import sys; print('{}.{}.{}'.format(*sys.version_info[:3]))" 2>/dev/null || echo "")+ _inspect_venv() {+ "$VENV_DIR/bin/python" -c \+ "import platform, sys; print(platform.machine(), '{}.{}.{}'.format(*sys.version_info[:3]))" \+ 2>/dev/null || echo " "+ }+ _info=$(_inspect_venv)+ _VENV_ARCH=${_info%% *}+ _PY_VER=${_info##* }++ if [ "$_VENV_ARCH" = "x86_64" ]; then+ echo " WARNING: venv was created with an x86_64 (Rosetta) Python on Apple Silicon."+ echo " Recreating venv with native arm64 Python ${PYTHON_VERSION}..."+ rm -rf "$VENV_DIR"+ run_install_cmd "recreate venv (arm64)" uv venv "$VENV_DIR" \+ --python "cpython-${PYTHON_VERSION}-macos-aarch64-none"+ if [ -x "$VENV_DIR/bin/python" ]; then+ : > "$VENV_DIR/.unsloth-studio-owned" 2>/dev/null || true+ fi+ # Re-inspect: the recreated arm64 venv may still be 3.13.8.+ _info=$(_inspect_venv)+ _VENV_ARCH=${_info%% *}+ _PY_VER=${_info##* }+ fi+if [ "$_PY_VER" = "3.13.8" ]; thenecho " WARNING: Python 3.13.8 has a known torch import bug."echo " Recreating venv with Python 3.12..."rm -rf "$VENV_DIR"PYTHON_VERSION="3.12"- run_install_cmd "recreate venv" uv venv "$VENV_DIR" --python "$PYTHON_VERSION"+ run_install_cmd "recreate venv" uv venv "$VENV_DIR" \+ --python "cpython-${PYTHON_VERSION}-macos-aarch64-none"if [ -x "$VENV_DIR/bin/python" ]; then: > "$VENV_DIR/.unsloth-studio-owned" 2>/dev/null || truefi