This is a known compatibility issue between newer LibreOffice versions and TextMaths. The problem typically stems from LibreOffice's changing Python environment and path handling.
Here are several solutions to try:
Find your LaTeX installation path:
bash
which latex
which pdflatex
which xelatex
In TextMaths configuration, manually set these paths:
Go to Tools > Add-ons > TextMaths > Configuration
Instead of relying on auto-detection, manually specify the full paths to:
latex
pdflatex
dvisvgm
dvipng
Or maybe use Python approach ?