Could you try to recreate your Python environment and reinstall Taipy? This code should work without any issues for Python 3.9 to 3.13. This is surely coming from 3.13 that we should support soon.
You could also provide to us how you installed Taipy and on which kind of virtual environments.