From 1a166eff565454505727cd864e2c212d10a8d18b Mon Sep 17 00:00:00 2001 From: Jatin K Malik Date: Thu, 12 Feb 2026 10:10:06 -0800 Subject: [PATCH] fix(install): execute GPU pip command directly, not via variable (#196) The previous fix stored the pip command in a variable: PYWHISPERCPP_INSTALL_CMD="GGML_CUDA=1 pip install ..." $PYWHISPERCPP_INSTALL_CMD This doesn't work because bash interprets "GGML_CUDA=1" as a command, not as an environment variable prefix. Fix: Use conditional logic to run the commands directly: if GGML_CUDA=1 pip install ...; then GPU_INSTALL_SUCCESS=true fi --- install.sh | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index db05291..f8d7fa6 100755 --- a/install.sh +++ b/install.sh @@ -1471,35 +1471,41 @@ install_python_package() { detect_nvidia_gpu || true detect_vulkan || true - local PYWHISPERCPP_INSTALL_CMD="pip install pywhispercpp" local GPU_BACKEND="CPU" + local GPU_INSTALL_SUCCESS=false if [[ "$HAS_NVIDIA_GPU" == "yes" ]]; then print_info "✓ NVIDIA GPU detected: $GPU_NAME" print_info " Installing pywhispercpp with CUDA support..." - PYWHISPERCPP_INSTALL_CMD="GGML_CUDA=1 pip install --force-reinstall git+https://github.com/absadiki/pywhispercpp" GPU_BACKEND="CUDA" + print_info "Installing pywhispercpp ($GPU_BACKEND backend)..." + if GGML_CUDA=1 pip install --force-reinstall git+https://github.com/absadiki/pywhispercpp --log "$PIP_LOG_FILE" 2>&1; then + GPU_INSTALL_SUCCESS=true + fi elif [[ "$HAS_VULKAN" == "yes" ]]; then print_info "✓ Vulkan detected: $VULKAN_DEVICE" print_info " Installing pywhispercpp with Vulkan support..." - PYWHISPERCPP_INSTALL_CMD="GGML_VULKAN=1 pip install --force-reinstall git+https://github.com/absadiki/pywhispercpp" GPU_BACKEND="Vulkan" - else - print_info "ℹ No GPU detected - installing CPU-only version" - print_info " CPU mode is still very fast!" - PYWHISPERCPP_INSTALL_CMD="pip install pywhispercpp" - GPU_BACKEND="CPU" + print_info "Installing pywhispercpp ($GPU_BACKEND backend)..." + if GGML_VULKAN=1 pip install --force-reinstall git+https://github.com/absadiki/pywhispercpp --log "$PIP_LOG_FILE" 2>&1; then + GPU_INSTALL_SUCCESS=true + fi fi - # Install pywhispercpp with GPU support - print_info "Installing pywhispercpp ($GPU_BACKEND backend)..." - if ! $PYWHISPERCPP_INSTALL_CMD --log "$PIP_LOG_FILE" 2>&1; then - print_warning "Failed to install pywhispercpp with GPU support, falling back to CPU version..." + # Fall back to CPU version if GPU install failed or no GPU detected + if [[ "$GPU_INSTALL_SUCCESS" != "true" ]]; then + if [[ "$GPU_BACKEND" != "CPU" ]]; then + print_warning "Failed to install pywhispercpp with $GPU_BACKEND support, falling back to CPU version..." + else + print_info "ℹ No GPU detected - installing CPU-only version" + print_info " CPU mode is still very fast!" + fi + GPU_BACKEND="CPU" + print_info "Installing pywhispercpp ($GPU_BACKEND backend)..." pip install pywhispercpp --log "$PIP_LOG_FILE" || { print_error "Failed to install pywhispercpp" return 1 } - GPU_BACKEND="CPU (fallback)" fi print_success "pywhispercpp installed with $GPU_BACKEND backend"