Check_raspbain_version Error in new install

Robot-hat won’t install. I’m ‘blindly’ following these instructions.

cd ~/
git clone -b v2.0 GitHub - sunfounder/robot-hat: Robot Hat python library
cd robot-hat
sudo python3 install.py

GETTING THIS ERROR.

Robot Hat Python Library v2.3.6
Traceback (most recent call last):
File “/home/psblock/robot-hat/install.py”, line 108, in
raspbain_version = check_raspbain_version()
^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/psblock/robot-hat/install.py”, line 91, in check_raspbain_version
return int(result.strip())
^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ‘trixie/sid’

WHAT’S WRONG?

You appear to be trying to use Trixie:

….with base 10: ‘trixie/sid’,

Debian 13, which isn’t yet fully supported. Use bookworm.

Hi, checkout the topic above. I was able to install robot-HAT v4 on raspberry pi5 running Ubuntu 24.04 manually with the steps above. The install.py likewise fails on Ubuntu as the prerequisite programs are not bundled with it as are some of the requirements for the sound card. You might be able to get it working with other non-raspbian OS with similar steps

Trixie is Raspbian, so those missing packages from an ubuntu install are already included.

Gotchya. I guess the install script isn’t finding the expected release then.

Yes.

From the original error nessage …

   ValueError: invalid literal for int() with base 10: …

Bookworm seems to be expected to return an integer value (although I’ve not checked exactly what) as part of the version return string

However, Trixie is only returning an alphabetic string

‘trixie/sid’

IMHO, that’s a bug in Trixie, rather than Sunfounder’s but it’s early days still for Trixie!

I’ve had a look at the install.py file and I think I can see where is goes wrong at line 89:

def check_raspbain_version():
    _, result = run_command("cat /etc/debian_version|awk -F. '{print $1}'")
    return int(result.strip())

You would expect it returns a 13 for the Debian version and not a string. I can’t check it as I haven’t got 13 installed anywhere yet.

The script seems to only using the debian version to determine which version of libttspico-utils to install for pico2wave TTS package.

# Dependencies list installed with apt
# =================================================================
APT_INSTALL_LIST = [
    'raspi-config',
    "i2c-tools",
    "espeak",
    'libsdl2-dev',
    'libsdl2-mixer-dev',
    'portaudio19-dev',  # pyaudio
    'sox',
]
if raspbain_version in [12] and os_bit == 64:
    APT_INSTALL_LIST.append("libttspico-utils")  # tts -> pico2wave

For version 12 should just add libttspico-utils to the list of packages to install with apt

Later in the script, if libttspico-utils is not in the APT_INSTALL_LIST, a specific version of libttspico and libttspico-utils is installed for debian versions 12 or above >=12 :

if 'libttspico-utils' not in APT_INSTALL_LIST:
                _pool = 'http://ftp.debian.org/debian/pool/non-free/s/svox/'
                if raspbain_version >= 12:
                    libttspico= 'libttspico0t64_1.0+git20130326-14.1_armhf.deb'
                    libttspico_utils = 'libttspico-utils_1.0+git20130326-14.1_armhf.deb'
                elif raspbain_version < 12:
                    libttspico = 'libttspico0_1.0+git20130326-11_armhf.deb'
                    libttspico_utils = 'libttspico-utils_1.0+git20130326-11_armhf.deb'
                do(msg="install pico2wave",
                    cmd=f'wget {_pool}{libttspico}' +
                    f' &&wget {_pool}{libttspico_utils}' +
                    f' && apt-get install -f ./{libttspico} ./{libttspico_utils} -y'
                    )

Assuming the above script installs the correct versions for debian 13 (it looks like it that is the intention), then editing the install.py file to return 13 for the version check might just allow the script to run.

# comment out original code and simply return 13

def check_raspbain_version():
    # _, result = run_command("cat /etc/debian_version|awk -F. '{print $1}'")
    # return int(result.strip())
    return 13

Obviously I cannot verify if it would work or cause other unintended issues, but might be worth a try?