From 99436636fbc96fc2e8922ec7ae9fded55358320b Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 4 Aug 2025 14:16:11 +0500 Subject: [PATCH] bug fix: AlmaLinux 9 virtual environment creation TypeError - Added specific handling for AlmaLinux/Rocky Linux 9 similar to Ubuntu 22 - First attempts python3 -m venv for virtual environment creation - Falls back to virtualenv with proper Python path detection - Fixes TypeError: expected string or bytes-like object during installation --- cyberpanel.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cyberpanel.sh b/cyberpanel.sh index 4856ca8ad..67b02bbdb 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -2130,6 +2130,18 @@ if [[ "$Server_OS" = "Ubuntu" ]] && [[ "$Server_OS_Version" = "22" ]] ; then pip3 install --upgrade virtualenv virtualenv -p /usr/bin/python3 /usr/local/CyberCP fi +elif [[ "$Server_OS" = "CentOS" ]] && [[ "$Server_OS_Version" = "9" ]] ; then + echo -e "AlmaLinux/Rocky Linux 9 detected, using python3 -m venv..." + if python3 -m venv /usr/local/CyberCP 2>&1; then + echo -e "Virtual environment created successfully" + else + echo -e "python3 -m venv failed, trying virtualenv..." + # Ensure virtualenv is properly installed + pip3 install --upgrade virtualenv + # Find the correct python3 path + PYTHON_PATH=$(which python3 2>/dev/null || which python3.9 2>/dev/null || echo "/usr/bin/python3") + virtualenv -p "$PYTHON_PATH" /usr/local/CyberCP + fi else virtualenv -p /usr/bin/python3 /usr/local/CyberCP fi