Hope you’re well.
What is inside install.sh?
The Pi5 Architectures slightly different from the 4, so the installer may not be pi5 compatible.
Are you comfortable jumping inside install.sh and looking for any false HALs or hard coded ROM addresses that may no longer exist on pi5?
Totally fine. Lets go through it together.
Here is the code we want to inspect.
The first thing I’d do here is check the error message for something to search.
This line below is interesting, because it’s probably generated by the code. So let’s search for that.
Checking Dependencies. Please wait…
Here it is, looks like at minimum we made it to line 139.
inform "Checking Dependencies. Please wait..."
pip_pkg_install toml
CONFIG_VARS=`$PYTHON - <<EOF
import toml
config = toml.load("pyproject.toml")
p = dict(config['pimoroni'])
# Convert list config entries into bash arrays
for k, v in p.items():
v = "'\n\t'".join(v)
p[k] = f"('{v}')"
print("""
APT_PACKAGES={apt_packages}
SETUP_CMDS={commands}
CONFIG_TXT={configtxt}
""".format(**p))
EOF`
Looks like we didn’t make it past this CONF_VARS python file.
That’s trying to import a toml which is essentially a hardware abstraction config package.
That’s the kind thing we want to check up on. Let’s find that.
So the first thing I notice is that the toml says we require project 3.7.
That’s interesting and worth checking.
The second thing to notice is that this project uses Hatchling which is a buildchain.
I happen to know Hatchling doesn’t like opperating under sudo.
That actually lines up with something else I noticed
if [ $(id -u) -eq 0 ]; then
printf "Script should not be run as root. Try './install.sh'\n"
exit 1
fi
Ok the next thing I would want to see is this python config file actually looks like.
Try adding this line to your install.sh file and see if you can get an output.
I’d put it on line 162 just before the evaluation.
echo CONFIG_VARS
Does it all look good?
We want it to have a format similar to apt install python3-xyz
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
For more information visit http://rptl.io/venv
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Setting up i2c and SPI… Backing up /boot/config.txt to /boot/config.preinstall-weatherhat-2024-05-03-16-40-01.txt
/usr/bin/raspi-config: 319: cannot create /boot/firmware/config.txt.bak: Permission denied
mv: cannot stat ‘/boot/firmware/config.txt.bak’: No such file or directory
sed: couldn’t open temporary file /etc/modprobe.d/sedv3hM1f: Permission denied
Must be run as root - try ‘sudo dtparam …’
/usr/bin/raspi-config: 319: cannot create /boot/firmware/config.txt.bak: Permission denied
mv: cannot stat ‘/boot/firmware/config.txt.bak’: No such file or directory
sed: couldn’t open temporary file /etc/modprobe.d/sedTO0HcE: Permission denied
sed: couldn’t open temporary file /etc/sedCr1jgV: Permission denied
Must be run as root - try ‘sudo dtparam …’
Would you like to copy examples to /home/phil.kern/Pimoroni/weatherhat? [y/N] n
With the Pi 5 and Bookworm OS, something that has caught everyone off guard is that we need to use virtual environments when installing packages system-wide with pip, and this may be giving you an error.
We have a fix for it, but this is in thonny. I haven’t ever set up a virtual environment outside of Thonny, but here is an Adafruit tutorial on it.
Its suuuuper annoying and the folks at Raspberry Pi Foundation express their dislike of it, its out of their control.