KoljaB / RealtimeTTS

Converts text to speech in realtime
1.39k stars 119 forks source link

can't import name 'generate' from 'elevenlabs' #95

Closed junaidahmed361 closed 1 week ago

junaidahmed361 commented 1 week ago

I get this error after installing using pip:

ImportError                               Traceback (most recent call last)
----> from RealtimeTTS import TextToAudioStream, GTTSEngine
          engine = GTTSEngine() # replace with your TTS engine
          stream = TextToAudioStream(engine)

File ~/.micromamba/envs/default/lib/python3.12/site-packages/RealtimeTTS/__init__.py:1
----> from .text_to_stream import TextToAudioStream
          from .engines import BaseEngine, SystemEngine, AzureEngine, ElevenlabsEngine

File ~/.micromamba/envs/default/lib/python3.12/site-packages/RealtimeTTS/text_to_stream.py:1
----> from .engines import BaseEngine
          from .threadsafe_generators import CharIterator, AccumulatingThreadSafeGenerator
          from .stream_player import StreamPlayer, AudioConfiguration

File ~/.micromamba/envs/default/lib/python3.12/site-packages/RealtimeTTS/engines/__init__.py:4
          from .azure_engine import AzureEngine
          from .system_engine import SystemEngine
----> from .elevenlabs_engine import ElevenlabsEngine

File ~/.micromamba/envs/default/lib/python3.12/site-packages/RealtimeTTS/engines/elevenlabs_engine.py:2
          from .base_engine import BaseEngine
----> from elevenlabs import voices, generate, stream
          from elevenlabs.api import Voice, VoiceSettings
          import pyaudio

ImportError: cannot import name 'generate' from 'elevenlabs' (~/.micromamba/envs/default/lib/python3.12/site-packages/elevenlabs/__init__.py)

I don't expect a dependence on elevenlabs if I'm using one of the other engines. I'm running python 3.12 in a virtual environment on an M3 mac.

KoljaB commented 1 week ago

Please upgrade RealtimeTTS to version 0.4.1, elevenlabs has changed their API.

junaidahmed361 commented 1 week ago

This worked after downgrading python to 3.11. Seems the version 0.4.1 is not compatible with the latest python.

KoljaB commented 1 week ago

It never was compatible for python >= 3.12, because is uses coqui tts coqui tts and therefore is restricted to their max python version