diff --git a/scripts/install_birdnet.sh b/scripts/install_birdnet.sh index 74e4b42..e090ebe 100755 --- a/scripts/install_birdnet.sh +++ b/scripts/install_birdnet.sh @@ -9,6 +9,8 @@ export my_dir=$my_dir cd $my_dir/scripts || exit 1 +source install_helpers.sh + if [ "$(uname -m)" != "aarch64" ];then echo "BirdNET-Pi requires a 64-bit OS. It looks like your operating system is using $(uname -m), @@ -28,7 +30,8 @@ install_birdnet() { echo "Establishing a python virtual environment" python3 -m venv birdnet source ./birdnet/bin/activate - pip3 install -U -r $HOME/BirdNET-Pi/requirements.txt + get_tf_whl + pip3 install -U -r ./requirements_custom.txt } [ -d ${RECS_DIR} ] || mkdir -p ${RECS_DIR} &> /dev/null diff --git a/scripts/install_helpers.sh b/scripts/install_helpers.sh new file mode 100644 index 0000000..b884b14 --- /dev/null +++ b/scripts/install_helpers.sh @@ -0,0 +1,28 @@ +# this should only contain functions and assignments, ie source install.sh should not have side effects. + +get_tf_whl () { + BASE_URL=https://github.com/Nachtzuster/BirdNET-Pi/releases/download/v0.1/ + + PY_VERSION=$(python3 -c "import sys; print(f'{sys.version_info[0]}{sys.version_info[1]}')") + case "${PY_VERSION}" in + 39) + WHL=tflite_runtime-2.11.0-cp39-none-linux_aarch64.whl + ;; + 310) + WHL=tflite_runtime-2.11.0-cp310-none-linux_aarch64.whl + ;; + 311) + WHL=tflite_runtime-2.11.0-cp311-cp311-linux_aarch64.whl + ;; + *) + echo "No tflite version found" + WHL='' + ;; + esac + if [ -n "$WHL" ]; then + { + curl -L -o $HOME/BirdNET-Pi/$WHL $BASE_URL$WHL + sed "s/tflite_runtime.*/$WHL/" $HOME/BirdNET-Pi/requirements.txt > requirements_custom.txt + } + fi +}