Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation Error Mac M1 Processors #274

Closed
steelliberty opened this issue Apr 25, 2023 · 13 comments
Closed

Segmentation Error Mac M1 Processors #274

steelliberty opened this issue Apr 25, 2023 · 13 comments

Comments

@steelliberty
Copy link

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
Copy link

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
Copy link

russellballestrini commented Apr 25, 2023

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
Copy link
Author

steelliberty commented Apr 25, 2023 via email

@Jiangshan00001
Copy link

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
Copy link
Author

steelliberty commented Apr 26, 2023 via email

@James11222
Copy link

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
Copy link

polozhevets commented May 11, 2023

(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
Copy link
Author

steelliberty commented May 11, 2023 via email

@Jiangshan00001
Copy link

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.

@kaspesi
Copy link

kaspesi commented May 29, 2023

@Jiangshan00001 Worked for me thanks!

@skazi019
Copy link

skazi019 commented Jun 4, 2023

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
Copy link
Contributor

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

@nateshmbhat
Copy link
Owner

this has been fixed in latest version. open a new issue if the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants