nateshmbhat / pyttsx3

Offline Text To Speech synthesis for python
Mozilla Public License 2.0
1.99k stars 321 forks source link

Segmentation Error Mac M1 Processors #274

Open steelliberty opened 1 year ago

steelliberty commented 1 year ago

Macbook Pro with M1 Max processor Monterey 12.6 OS

simple results from command line error -- no stack trace just "segmentation error 11".

Anyway to work around this outside of getting an intel mac?

Jiangshan00001 commented 1 year ago

have no idea. maybe you could try this :

pip install pyttsx4

import pyttsx4 engine = pyttsx4.init() engine.save_to_file('i am Hello World', 'test1.wav') engine.runAndWait()

russellballestrini commented 1 year ago

Thanks for reporting, I also see this issue.

The error occurs when running init to create the engine.

>>> engine = pyttsx3.init()
zsh: segmentation fault python
steelliberty commented 1 year ago

Thank you for the quick response.

I did a new environment and installed pyttsx4, and used 3.10.11

Same results no stack trace, just a machine hardware type error : Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

And outside of pycharm, I got : zsh: segmentation fault python3 main.py

Jack

On Tue, Apr 25, 2023 at 11:21 AM Russell @.***> wrote:

Thanks for reporting, I also see this issue.

— Reply to this email directly, view it on GitHub https://github.com/nateshmbhat/pyttsx3/issues/274#issuecomment-1521987783, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHAO5R4LVUYLI6CVLA2TXTXC7TY7ANCNFSM6AAAAAAXLAV7MU . You are receiving this because you authored the thread.Message ID: @.***>

Jiangshan00001 commented 1 year ago

maybe it is a nss driver error. could you try : import pyttsx4 engine = pyttsx4.init('espeak') engine.save_to_file('i am Hello World', 'test1.wav') engine.runAndWait()

steelliberty commented 1 year ago

we need something -- error KeyError: 'espeak'

On Wed, Apr 26, 2023 at 3:29 AM Jiangshan00001 @.***> wrote:

maybe it is a nss driver error. could you try : import pyttsx4 engine = pyttsx4.init('espeak') engine.save_to_file('i am Hello World', 'test1.wav') engine.runAndWait()

— Reply to this email directly, view it on GitHub https://github.com/nateshmbhat/pyttsx3/issues/274#issuecomment-1522920251, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHAO5WB26MNN7C3IFXSM2DXDDFEPANCNFSM6AAAAAAXLAV7MU . You are receiving this because you authored the thread.Message ID: @.***>

James11222 commented 1 year ago

I get this same issue on the M1 Mac, I tried reverting to an older version of Python (3.4, 3.5, 3.6) and neither of these seemed to work. I get the same issue of

zsh: segmentation fault python3 main.py

with no stack trace.

Is there any work being done to try and fix this issue?

polozhevets commented 1 year ago
(env) alex@Alexanders-MacBook-Pro projects % python3 -q -X faulthandler
>>> import pyttsx4
>>> engine = pyttsx4.init()
Fatal Python error: Segmentation fault

Current thread 0x00000001fd309b40 (most recent call first):
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1233 in create_module
  File "<frozen importlib._bootstrap>", line 573 in module_from_spec
  File "<frozen importlib._bootstrap>", line 676 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1149 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1178 in _find_and_load
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1234 in _handle_fromlist
  File "/Users/alex/projects/env/lib/python3.11/site-packages/objc/__init__.py", line 6 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 940 in exec_module
  File "<frozen importlib._bootstrap>", line 690 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1149 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1178 in _find_and_load
  File "/Users/alex/projects/env/lib/python3.11/site-packages/CoreFoundation/__init__.py", line 9 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 940 in exec_module
  File "<frozen importlib._bootstrap>", line 690 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1149 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1178 in _find_and_load
  File "/Users/alex/projects/env/lib/python3.11/site-packages/Foundation/__init__.py", line 9 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 940 in exec_module
  File "<frozen importlib._bootstrap>", line 690 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1149 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1178 in _find_and_load
  File "/Users/alex/projects/env/lib/python3.11/site-packages/pyttsx4/drivers/nsss.py", line 2 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 940 in exec_module
  File "<frozen importlib._bootstrap>", line 690 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1149 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1178 in _find_and_load
  File "<frozen importlib._bootstrap>", line 1206 in _gcd_import
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126 in import_module
  File "/Users/alex/projects/env/lib/python3.11/site-packages/pyttsx4/driver.py", line 50 in __init__
  File "/Users/alex/projects/env/lib/python3.11/site-packages/pyttsx4/engine.py", line 30 in __init__
  File "/Users/alex/projects/env/lib/python3.11/site-packages/pyttsx4/__init__.py", line 22 in init
  File "<stdin>", line 1 in <module>
zsh: segmentation fault  python3 -q -X faulthandler

It's looks like memory access problem. I have the same issue with Apple and Intel MacBooks

steelliberty commented 1 year ago

Thank you for the research. Hopefully, we get this fixed soon.

On Thu, May 11, 2023 at 9:06 AM Alexander @.***> wrote:

(env) @.*** projects % python3 -q -X faulthandler

import pyttsx4 engine = pyttsx4.init() Fatal Python error: Segmentation fault

Current thread 0x00000001fd309b40 (most recent call first): File "", line 241 in _call_with_frames_removed File "", line 1233 in create_module File "", line 573 in module_from_spec File "", line 676 in _load_unlocked File "", line 1149 in _find_and_load_unlocked File "", line 1178 in _find_and_load File "", line 241 in _call_with_frames_removed File "", line 1234 in _handle_fromlist File "/Users/alex/projects/env/lib/python3.11/site-packages/objc/init.py", line 6 in File "", line 241 in _call_with_frames_removed File "", line 940 in exec_module File "", line 690 in _load_unlocked File "", line 1149 in _find_and_load_unlocked File "", line 1178 in _find_and_load File "/Users/alex/projects/env/lib/python3.11/site-packages/CoreFoundation/init.py", line 9 in File "", line 241 in _call_with_frames_removed File "", line 940 in exec_module File "", line 690 in _load_unlocked File "", line 1149 in _find_and_load_unlocked File "", line 1178 in _find_and_load File "/Users/alex/projects/env/lib/python3.11/site-packages/Foundation/init.py", line 9 in File "", line 241 in _call_with_frames_removed File "", line 940 in exec_module File "", line 690 in _load_unlocked File "", line 1149 in _find_and_load_unlocked File "", line 1178 in _find_and_load File "/Users/alex/projects/env/lib/python3.11/site-packages/pyttsx4/drivers/nsss.py", line 2 in File "", line 241 in _call_with_frames_removed File "", line 940 in exec_module File "", line 690 in _load_unlocked File "", line 1149 in _find_and_load_unlocked File "", line 1178 in _find_and_load File "", line 1206 in _gcd_import File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/init.py", line 126 in import_module File "/Users/alex/projects/env/lib/python3.11/site-packages/pyttsx4/driver.py", line 50 in init File "/Users/alex/projects/env/lib/python3.11/site-packages/pyttsx4/engine.py", line 30 in init File "/Users/alex/projects/env/lib/python3.11/site-packages/pyttsx4/init.py", line 22 in init File "", line 1 in zsh: segmentation fault python3 -q -X faulthandler

It's looks like memory access problem

— Reply to this email directly, view it on GitHub https://github.com/nateshmbhat/pyttsx3/issues/274#issuecomment-1543973498, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHAO5WOMAWCRSMPEXBRL2TXFTP4BANCNFSM6AAAAAAXLAV7MU . You are receiving this because you authored the thread.Message ID: @.***>

Jiangshan00001 commented 1 year ago

i have check the error, and it seems the pyobjc version problem.

the problem happens when pyobjc version is 9.1.1.

pip install pyobjc==9.0.1 fix the problem.

try and see.

further more: https://github.com/ronaldoussoren/pyobjc/issues/551 pyobjc with version 9.1.1 has a Segmentation fault bug. it is fixed in version 9.2 https://pyobjc.readthedocs.io/en/latest/changelog.html

let's waitting for the 9.2 version or just use old 9.0.1 version.

kaspesi commented 1 year ago

@Jiangshan00001 Worked for me thanks!

skazi019 commented 1 year ago

i have check the error, and it seems the pyobjc version problem.

the problem happens when pyobjc version is 9.1.1.

pip install pyobjc==9.0.1 fix the problem.

try and see.

further more: ronaldoussoren/pyobjc#551 pyobjc with version 9.1.1 has a Segmentation fault bug. it is fixed in version 9.2 https://pyobjc.readthedocs.io/en/latest/changelog.html

let's waitting for the 9.2 version or just use old 9.0.1 version.

I was getting the same "Segmentation Fault" running on an intel i5 MacBook pro. Upgrading the pyobjc as above fixed the issue for me as well!

Many thanks!

willwade commented 3 weeks ago

fixed in this fork https://github.com/nateshmbhat/pyttsx3