Skip to content

Commit

Permalink
Fix issue #91 with Python version
Browse files Browse the repository at this point in the history
  • Loading branch information
goldyfruit committed Jun 24, 2024
1 parent 18e50ac commit 3ae84f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
29 changes: 6 additions & 23 deletions utils/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ function get_os_information() {
# the installer will exit with a message.
function required_packages() {
echo -ne "➤ Validating installer package requirements... "
PYTHON_VERSION="$MAX_PYTHON_VERSION"

# Add extra packages if a Raspberry Pi board is detected
declare extra_packages
if [ "$RASPBERRYPI_MODEL" != "N/A" ]; then
Expand All @@ -209,34 +207,19 @@ function required_packages() {

case "$DISTRO_NAME" in
debian | ubuntu | raspbian | linuxmint | zorin)
[ "$DISTRO_VERSION_ID" == "11" ] && export PYTHON_VERSION="3"
# This is a temporary fix until OVOS is confirmed to work with
# Python 3.12. Requirements are PocketSphinx, tflite-runtime and
# onnxruntime Python packages.
if [ "$(ver "$DISTRO_VERSION_ID")" -ge "$(ver 24.04)" ]; then
{
apt-get update
apt-get install --no-install-recommends -y software-properties-common
add-apt-repository ppa:deadsnakes/ppa -y
} &>>"$LOG_FILE"
fi
apt-get update &>>"$LOG_FILE"
apt-get install --no-install-recommends -y "python${PYTHON_VERSION}" "python${PYTHON_VERSION}-dev" python3-pip "python${PYTHON_VERSION}-venv" whiptail expect jq "${extra_packages[@]}" &>>"$LOG_FILE"
apt-get install --no-install-recommends -y "python3" "python3-dev" python3-pip "python3-venv" whiptail expect jq "${extra_packages[@]}" &>>"$LOG_FILE"
;;
fedora)
export PYTHON_VERSION
dnf install -y python3.11 python3.11-devel python3-pip python3-virtualenv newt expect jq "${extra_packages[@]}" &>>"$LOG_FILE"
dnf install -y python3 python3-devel python3-pip python3-virtualenv newt expect jq "${extra_packages[@]}" &>>"$LOG_FILE"
;;
rocky | centos)
export PYTHON_VERSION
dnf install -y python3.11 python3.11-devel python3-pip newt expect jq "${extra_packages[@]}" &>>"$LOG_FILE"
dnf install -y python3 python3-devel python3-pip newt expect jq "${extra_packages[@]}" &>>"$LOG_FILE"
;;
opensuse-tumbleweed | opensuse-leap)
export PYTHON_VERSION
zypper install -y python311 python311-devel python3-pip python3-rpm newt expect jq "${extra_packages[@]}" &>>"$LOG_FILE"
zypper install -y python3 python3-devel python3-pip python3-rpm newt expect jq "${extra_packages[@]}" &>>"$LOG_FILE"
;;
arch | manjaro | endeavouros)
export PYTHON_VERSION
pacman -Sy --noconfirm python python-pip python-virtualenv libnewt expect jq "${extra_packages[@]}" &>>"$LOG_FILE"
;;
*)
Expand All @@ -262,14 +245,14 @@ function create_python_venv() {
fi

if [ ! -d "$VENV_PATH" ]; then
"python${PYTHON_VERSION}" -m venv "$VENV_PATH" &>>"$LOG_FILE"
python3 -m venv "$VENV_PATH" &>>"$LOG_FILE"
fi

# shellcheck source=/dev/null
source "$VENV_PATH/bin/activate"

pip3 install --upgrade pip setuptools &>>"$LOG_FILE"
chown "$RUN_AS":"$(id -ng "$RUN_AS")" "$VENV_PATH"
chown "$RUN_AS":"$(id -ng "$RUN_AS")" "$VENV_PATH" &>>"$LOG_FILE"
echo -e "[$done_format]"
}

Expand Down
1 change: 0 additions & 1 deletion utils/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export DT_FILE=/sys/firmware/devicetree/base/model
export I2C_BUS="1"
export INSTALLER_VENV_NAME="ovos-installer"
export LOG_FILE=/var/log/ovos-installer.log
export MAX_PYTHON_VERSION="3.11"
export NEWT_COLORS="
root=white,black
border=black,lightgray
Expand Down

0 comments on commit 3ae84f9

Please sign in to comment.