diff --git a/installers/common.sh b/installers/common.sh index ad56b269..df65a0ae 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -585,6 +585,17 @@ function _create_openvpn_scripts() { function _install_restapi() { _install_log "Installing and enabling RestAPI" sudo cp -r "$webroot_dir/api" "$raspap_dir/api" || _install_status 1 "Unable to move api folder" + + if ! command -v python &> /dev/null; then + echo "Python is not installed. Installing Python..." + sudo apt update + sudo apt install -y python3 python3-pip + echo "Python installed successfully." + else + echo "Python is already installed." + sudo apt install python3-pip -y + + fi python -m pip install -r "$raspap_dir/api/requirements.txt" --break-system-packages || _install_status 1 " Unable to install pip modules" echo "Moving restapi systemd unit control file to /lib/systemd/system/"