I'm running Debian Bookworm on a Raspberry Pi and developing a Python program that uses sqlite3. The program works on my NixOS laptop, but on the Pi Python reports that SQLite does not have an IF() function. The Pi has Python 3.11, and I also found that its SQLite version is 3.40 while newer releases are available. Running apt update and apt upgrade reports that everything is current, but the installed packages do not move to the latest upstream versions. Why is this happening, and what is the safest way to get the program working?
4 Answers
You can use a Raspberry Pi-oriented alternative such as DietPi, or choose another ARM distribution with newer repositories. Just keep in mind that newer packages are not automatically better: stable Debian versions are older by design, but they receive security fixes and are generally tested more thoroughly.
The SQLite issue may not actually be caused by the version. SQLite does not provide the MySQL-style `IF()` function. Use a supported conditional expression such as `CASE WHEN condition THEN value ELSE other_value END`; on versions that support it, `iif(condition, value, other_value)` is another option. Check the SQL syntax your program uses before replacing the system SQLite library.
Avoid replacing the system Python just to get a newer interpreter. Keep the OS-managed Python intact and install the required Python version or dependencies in an isolated environment using a tool such as `uv`, `pyenv`, or a virtual environment. This reduces the chance of breaking system utilities and lets the project use its own Python setup.
Debian Bookworm is a stable release, so its packages are intentionally kept at versions that were tested when the release was prepared. `apt update` refreshes the package lists and `apt upgrade` installs the newest versions available for that release; it does not upgrade everything to the latest upstream release. Moving to testing or unstable could provide newer packages, but it can also introduce breakage and Raspberry Pi-specific configuration problems. Switching distributions, such as to Arch, Ubuntu, Alpine, or another ARM-supported option, is another possibility, but it may require more setup and troubleshooting.

What kinds of Raspberry Pi configuration could break if I enabled testing or unstable repositories?