From b685e1df1a957a6c683d016087b135768a0c4769 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 13 Dec 2025 21:34:53 +0000 Subject: [PATCH 2/3] Enhance pip installation with better error handling and consistency Co-authored-by: ShaYmez <76499782+ShaYmez@users.noreply.github.com> --- CHANGELOG.md | 12 +++++++++ hblink3-docker-install.sh | 56 +++++++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07f25ee..bea1272 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Enhanced pip_install helper function with comprehensive error handling and user feedback +- Added proper error checking after all pip package installations +- Improved error messages to help users diagnose installation failures +- Added directory verification before installing from requirements.txt +- Changed deprecated --force flag to --force-reinstall for attrs package installation + +### Fixed +- Silent pip installation failures now properly reported to users +- Missing requirements.txt file now handled gracefully with warning instead of silent failure +- pip installation errors now cause the installer to exit with proper error messages + ## [1.5.0] - 2024-12-13 ### Verified diff --git a/hblink3-docker-install.sh b/hblink3-docker-install.sh index c7aa44d..2818541 100755 --- a/hblink3-docker-install.sh +++ b/hblink3-docker-install.sh @@ -235,17 +235,63 @@ pip_install() { local args="$@" if [ $VERSION -ge 12 ]; then # For Debian 12+, try with --break-system-packages flag first - pip3 install --break-system-packages $args 2>/dev/null || pip3 install $args + echo "Installing Python packages for Debian $VERSION: $args" + if pip3 install --break-system-packages $args; then + echo "Successfully installed: $args" + return 0 + else + echo "Warning: Installation with --break-system-packages failed, trying standard installation..." + if pip3 install $args; then + echo "Successfully installed: $args" + return 0 + else + echo "ERROR: Failed to install: $args" + return 1 + fi + fi else # For Debian 10-11, use standard pip installation - pip3 install $args + echo "Installing Python packages for Debian $VERSION: $args" + if pip3 install $args; then + echo "Successfully installed: $args" + return 0 + else + echo "ERROR: Failed to install: $args" + return 1 + fi fi } echo "Installing Python dependencies..." - pip_install setuptools wheel - pip_install -r requirements.txt - pip_install attrs --force + cd $HBMONDIR + + # Install setuptools and wheel first + if ! pip_install setuptools wheel; then + echo "ERROR: Failed to install setuptools and wheel" + echo "Please check your internet connection and Python installation" + exit 1 + fi + + # Check if requirements.txt exists before trying to install + if [ -f requirements.txt ]; then + if ! pip_install -r requirements.txt; then + echo "ERROR: Failed to install packages from requirements.txt" + echo "This may be due to network issues or missing system dependencies" + exit 1 + fi + else + echo "WARNING: requirements.txt not found in $HBMONDIR" + echo "Continuing installation without requirements.txt dependencies..." + fi + + # Install attrs with --force flag (note: --force is deprecated, using --force-reinstall) + if ! pip_install attrs --force-reinstall; then + echo "WARNING: Failed to install attrs with --force-reinstall, trying without force..." + if ! pip_install attrs; then + echo "ERROR: Failed to install attrs package" + exit 1 + fi + fi echo Install /opt/HBMonv2/config.py ... cat << EOF > /opt/HBMonv2/config.py From f7e9ef474f27b676fd783a74796949a5bd44effa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 13 Dec 2025 21:37:04 +0000 Subject: [PATCH 3/3] Fix indentation consistency in pip installation section Co-authored-by: ShaYmez <76499782+ShaYmez@users.noreply.github.com> --- hblink3-docker-install.sh | 64 +++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/hblink3-docker-install.sh b/hblink3-docker-install.sh index 2818541..5b5ba01 100755 --- a/hblink3-docker-install.sh +++ b/hblink3-docker-install.sh @@ -262,38 +262,38 @@ pip_install() { fi } - echo "Installing Python dependencies..." - cd $HBMONDIR - - # Install setuptools and wheel first - if ! pip_install setuptools wheel; then - echo "ERROR: Failed to install setuptools and wheel" - echo "Please check your internet connection and Python installation" - exit 1 - fi - - # Check if requirements.txt exists before trying to install - if [ -f requirements.txt ]; then - if ! pip_install -r requirements.txt; then - echo "ERROR: Failed to install packages from requirements.txt" - echo "This may be due to network issues or missing system dependencies" - exit 1 - fi - else - echo "WARNING: requirements.txt not found in $HBMONDIR" - echo "Continuing installation without requirements.txt dependencies..." - fi - - # Install attrs with --force flag (note: --force is deprecated, using --force-reinstall) - if ! pip_install attrs --force-reinstall; then - echo "WARNING: Failed to install attrs with --force-reinstall, trying without force..." - if ! pip_install attrs; then - echo "ERROR: Failed to install attrs package" - exit 1 - fi - fi - - echo Install /opt/HBMonv2/config.py ... +echo "Installing Python dependencies..." +cd $HBMONDIR + +# Install setuptools and wheel first +if ! pip_install setuptools wheel; then + echo "ERROR: Failed to install setuptools and wheel" + echo "Please check your internet connection and Python installation" + exit 1 +fi + +# Check if requirements.txt exists before trying to install +if [ -f requirements.txt ]; then + if ! pip_install -r requirements.txt; then + echo "ERROR: Failed to install packages from requirements.txt" + echo "This may be due to network issues or missing system dependencies" + exit 1 + fi +else + echo "WARNING: requirements.txt not found in $HBMONDIR" + echo "Continuing installation without requirements.txt dependencies..." +fi + +# Install attrs with --force flag (note: --force is deprecated, using --force-reinstall) +if ! pip_install attrs --force-reinstall; then + echo "WARNING: Failed to install attrs with --force-reinstall, trying without force..." + if ! pip_install attrs; then + echo "ERROR: Failed to install attrs package" + exit 1 + fi +fi + +echo Install /opt/HBMonv2/config.py ... cat << EOF > /opt/HBMonv2/config.py ############################################################################### # HBMonv2 Configuration File Example