Found the answer:
I added to /opt/homebrew/Cellar/octave/9.2.0_1/share/octave/site/m/startup/octaverc
the lines:
setenv("PYTHON", "/opt/homebrew/bin/python3")
setenv("PYTHONPATH", [getenv("HOME")"/.local/pipx/venvs/sympy/lib/python3.13/site-packages"])