Closed valentinweyer closed 8 months ago
Adding this solved it:
from phonemizer.backend.espeak.wrapper import EspeakWrapper
_ESPEAK_LIBRARY = '/opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.1.1.48.dylib'. #use the Path to the library.
EspeakWrapper.set_library(_ESPEAK_LIBRARY)
Thanks.
on macOS Sonoma 14.2.1 M1 pro
RuntimeError Traceback (most recent call last) Cell In[1], line 9 6 import phonemizer 8 text = "Hello, how are you?" ----> 9 phonemes = phonemizer.phonemize(text, language='en-us', backend='espeak', strip=True) 10 print(phonemes)
File ~/opt/anaconda3/envs/phenv/lib/python3.9/site-packages/phonemizer/phonemize.py:206, in phonemize(text, language, backend, separator, strip, prepend_text, preserve_empty_lines, preserve_punctuation, punctuation_marks, with_stress, tie, language_switch, words_mismatch, njobs, logger) 204 # initialize the phonemization backend 205 if backend == 'espeak': --> 206 phonemizer = BACKENDS[backend]( 207 language, 208 punctuation_marks=punctuation_marks, 209 preserve_punctuation=preserve_punctuation, 210 with_stress=with_stress, 211 tie=tie, 212 language_switch=language_switch, 213 words_mismatch=words_mismatch, 214 logger=logger) 215 elif backend == 'espeak-mbrola': 216 phonemizer = BACKENDS[backend]( 217 language, 218 logger=logger)
File ~/opt/anaconda3/envs/phenv/lib/python3.9/site-packages/phonemizer/backend/espeak/espeak.py:45, in EspeakBackend.init(self, language, punctuation_marks, preserve_punctuation, with_stress, tie, language_switch, words_mismatch, logger) 37 def init(self, language: str, 38 punctuation_marks: Optional[Union[str, Pattern]] = None, 39 preserve_punctuation: bool = False, (...) 43 words_mismatch: WordMismatch = 'ignore', 44 logger: Optional[Logger] = None): ---> 45 super().init( 46 language, punctuation_marks=punctuation_marks, 47 preserve_punctuation=preserve_punctuation, logger=logger) 49 self._espeak.set_voice(language) 50 self._with_stress = with_stress
File ~/opt/anaconda3/envs/phenv/lib/python3.9/site-packages/phonemizer/backend/espeak/base.py:39, in BaseEspeakBackend.init(self, language, punctuation_marks, preserve_punctuation, logger) 35 def init(self, language: str, 36 punctuation_marks: Optional[Union[str, Pattern]] = None, 37 preserve_punctuation: bool = False, 38 logger: Optional[Logger] = None): ---> 39 super().init( 40 language, 41 punctuation_marks=punctuation_marks, 42 preserve_punctuation=preserve_punctuation, 43 logger=logger) 45 self._espeak = EspeakWrapper() 46 self.logger.debug('loaded %s', self._espeak.library_path)
File ~/opt/anaconda3/envs/phenv/lib/python3.9/site-packages/phonemizer/backend/base.py:77, in BaseBackend.init(self, language, punctuation_marks, preserve_punctuation, logger) 75 # ensure the backend is installed on the system 76 if not self.is_available(): ---> 77 raise RuntimeError( # pragma: nocover 78 '{} not installed on your system'.format(self.name())) 80 self._logger = logger 81 self._logger.info( 82 'initializing backend %s-%s', 83 self.name(), '.'.join(str(v) for v in self.version()))
RuntimeError: espeak not installed on your system
Adding this solved it:
from phonemizer.backend.espeak.wrapper import EspeakWrapper _ESPEAK_LIBRARY = '/opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.1.1.48.dylib'. #use the Path to the library. EspeakWrapper.set_library(_ESPEAK_LIBRARY)
Thanks.
What changes did you have to make? Could you please raise a PR?
Thanks!
Environment
Issue Description I am attempting to run the
inference_tts.ipynb
notebook on an Apple Silicon Mac. As part of adapting the code for Apple Silicon, I replaced CUDA references with MPS (or CPU where MPS isn't an option). However, I encountered a runtime error related toespeak
not being recognized by the system despite being installed.Steps taken
espeak
via Homebrew usingbrew install espeak
.espeak
installation withespeak --version
, which outputs 'eSpeak NG text-to-speech: 1.51.1'inference_tts.ipynb
notebook after making necessary modifications for MPS compatibility.RuntimeError: espeak not installed on your system
upon executing Cell 4.Behavior Despite
espeak
being installed (confirmed via command line), aRuntimeError
is thrown indicating thatespeak
is not installed on the system.Troubleshooting Steps Taken
espeak
is accessible via the command line and shows the installed version.espeak
through Homebrew.espeak
is installed.Full output with error
I would also really like to do it without e.g. Docker, because I want to try to use MPS for the Apple Silicon GPU.
Would appreciate any guidance on resolving this issue so that
espeak
is correctly recognized by the system and the notebook can run as intended.