I wanted to try out the pyttsx3 library in python 3.11.2 on MacOS Monterey v12.6.3. I followed the pyttsx3 tutorial as a starter, but am failing at the initialisation step of the engine:
Python 3.11.2 (main, Feb 16 2023, 03:15:23) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyttsx3
>>> engine = pyttsx3.init()
Segmentation fault: 11
I was tbh expecting this to just work out of the box, but maybe I need to install some dependencies or so? In the documentation linked above, it says to make sure that espeak
and ffmpeg
are installed, but it's under the "saving a voice to a file" part and I'm not on Linux. I tried to search for the topic on SO, but only found the same pyttsx3 tutorial instructions as in the documentation linked above (e.g. here) or old errors with other libraries such as this - since the error message isn't very specific.
I've also brew install
-ed espeak
and ffmpeg
as stated in the github readme (although it was stated if on linux but it's all unix I guess), however libespeak1
wasn't an available formula.
Any ideas of what might be going wrong are appreciated!
the problem is not with the machine. The pyttsx3 module is old and this causes some malfunctioning. If you want to use this module, you will have to use older python version. My advice is 3.6.15 because any earlier version throws errors during installation process.
I am on macOS Monterey 12.4, and this worked just fine.