Jiangshan00001 / pyttsx4

Offline Text To Speech synthesis for python
Mozilla Public License 2.0
44 stars 8 forks source link

coqui_ai_tts TypeError TTS.list_models() in Ubuntu22.04 #18

Open dearfad opened 8 months ago

dearfad commented 8 months ago

import pyttsx4 engine = pyttsx4.init('coqui_ai_tts') engine.say('this is an english text to voice test, listen it carefully and tell who i am.') engine.runAndWait()

Traceback (most recent call last): File "/home/dearfad/miniconda3/envs/breastvsp/lib/python3.10/site-packages/pyttsx4/init.py", line 20, in init eng = _activeEngines[driverName] File "/home/dearfad/miniconda3/envs/breastvsp/lib/python3.10/weakref.py", line 137, in getitem o = self.data[key]() KeyError: 'coqui_ai_tts' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/dearfad/Repositories/breastvsp/libs/tts/coqui.py", line 3, in engine = pyttsx4.init('coqui_ai_tts') File "/home/dearfad/miniconda3/envs/breastvsp/lib/python3.10/site-packages/pyttsx4/init.py", line 22, in init eng = Engine(driverName, debug) File "/home/dearfad/miniconda3/envs/breastvsp/lib/python3.10/site-packages/pyttsx4/engine.py", line 30, in init self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug) File "/home/dearfad/miniconda3/envs/breastvsp/lib/python3.10/site-packages/pyttsx4/driver.py", line 52, in init self._driver = self._module.buildDriver(weakref.proxy(self)) File "/home/dearfad/miniconda3/envs/breastvsp/lib/python3.10/site-packages/pyttsx4/drivers/coqui_ai_tts.py", line 15, in buildDriver return TTSDriver(proxy) File "/home/dearfad/miniconda3/envs/breastvsp/lib/python3.10/site-packages/pyttsx4/drivers/coqui_ai_tts.py", line 21, in init self.model_name = TTS(TTS.list_models()[0]) TypeError: TTS.list_models() missing 1 required positional argument: 'self'

How to solve it...

nainglinwai1 commented 8 months ago

I have the same issue too. Have you got the solution?

yecllsl commented 4 months ago

I have the same issue too. windows 11,python 3.11 发生异常: TypeError TTS.list_models() missing 1 required positional argument: 'self' KeyError: 'coqui_ai_tts'

During handling of the above exception, another exception occurred:

......, line 13, in engine = pyttsx4.init('coqui_ai_tts') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: TTS.list_models() missing 1 required positional argument: 'self'

Battant commented 1 month ago

Hello,

I have Same problem on Mac OS and windows

Example on windows 11 and python.12.4

Code : `

import pyttsx4

engine4 = pyttsx4.init('coqui_ai_tts')

` Actual result : Traceback (most recent call last): File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyttsx4__init__.py", line 20, in init eng = _activeEngines[driverName]


  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\weakref.py", line 136, in __getitem__
    o = self.data[key]()
        ~~~~~~~~~^^^^^
KeyError: 'coqui_ai_tts'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyttsx4\drivers\coqui_ai_tts.py", line 7, in <module>
    from TTS.api import TTS
ModuleNotFoundError: No module named 'TTS'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\username\src\program\test_tts_native.py", line 5, in <module>
    engine4 = pyttsx4.init('coqui_ai_tts')
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyttsx4\__init__.py", line 22, in init
    eng = Engine(driverName, debug)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyttsx4\engine.py", line 30, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyttsx4\driver.py", line 50, in __init__
    self._module = importlib.import_module(name)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyttsx4\drivers\coqui_ai_tts.py", line 12, in <module>
    from TTS.api import TTS
ModuleNotFoundError: No module named 'TTS'
`
engine4.say('this is an english text to voice test.')
-

Expand result 😀 
Initial successful 😀 
Could you help me please to fix this issus

Best regards

Battant