RuntimeError: espeak not installed on your system
Opened this issue · 13 comments
I am facing this error when I try to initialize the phonemizer backend:
RuntimeError: espeak not installed on your system
I already have installed espeak-ng using pacman -S espeak-ng
and set the path PHONEMIZER_ESPEAK_LIBRARY
to my espeak binary. Any idea on how to fix this?
Details:
OS: Arch linux.
Python version: 3.8.18
espeak-ng version: 1.51.1
I'm having the same issue
@rumbleFTW I'm on MacOS
I just had the same issue. I did some digging. I think it has to do with how I made virtual environment at least for me. I used conda just as normally as I do. Then I called ctypes.cdll.LoadLibrary('libespeak-ng.so.1')
, which is called when EspeakAPI
is initialized.
Note that I installed espeak-ng
from Arch repo just like @rumbleFTW did.
Here is the output
import ctypes
ctypes.cdll.LoadLibrary('libespeak-ng.so.1')
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
Cell In[6], line 1
----> 1 ctypes.cdll.LoadLibrary('libespeak-ng.so.1')
File ~/miniconda3/envs/tts/lib/python3.10/ctypes/__init__.py:452, in LibraryLoader.LoadLibrary(self, name)
451 def LoadLibrary(self, name):
--> 452 return self._dlltype(name)
File ~/miniconda3/envs/tts/lib/python3.10/ctypes/__init__.py:374, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
371 self._FuncPtr = _FuncPtr
373 if handle is None:
--> 374 self._handle = _dlopen(self._name, mode)
375 else:
376 self._handle = handle
OSError: /home/seongbin/miniconda3/envs/tts/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /usr/lib/libespeak-ng.so.1)
It's looking for libs in relative path. I know that conda redefines lib path as well as bin path. So the solutions I am thinking are 1. install espeak-ng using conda so that conda can places libs as well as bins under new path or 2. do not use conda, use something else like venv.
I will put updates when I tried them. But I won't have time this weekend. So if someone wants to try, please do and it would be appreciated if someone can verify them.
@sbinnee You are probably correct, since I am trying to do this in a conda env as well, and might be because of the way conda handles the libs. However the espeak-ng package is not present in the conda repositories as far as I know. I tried the second method that you suggested i.e. use venv for the environment, and it worked flawlessly. So it is indeed because of the conda env. Although this solves the issue, my workflow is really dependent on conda, so I still need to figure out how to make it work in a conda env.
Hi, did you tried that (from docs):
conda env config vars set PHONEMIZER_ESPEAK_LIBRARY="/somewhere/to/libespeak-ng.so"
?
Just tried. Didn't work for me. Can someone else like @sbinnee test out if it solves the issue on their system?
I met the same problem. My platform is Linux. Besides, I don't know where the 'libespeak-ng.so' is located
Yeah, this is definitely still a problem for windows users.
Tried:
from phonemizer.backend.espeak.wrapper import EspeakWrapper
_ESPEAK_LIBRARY = r'C:\Program Files\eSpeak NG\libespeak-ng.dll'
EspeakWrapper.set_library(_ESPEAK_LIBRARY)
Traceback (most recent call last):
File "E:\vits2\vits2\lib\site-packages\joblib\externals\loky\process_executor.py", line 426, in _process_worker
call_item = call_queue.get(block=True, timeout=timeout)
File "F:\Python310\lib\multiprocessing\queues.py", line 122, in get
return _ForkingPickler.loads(res)
File "E:\vits2\vits2\lib\site-packages\phonemizer\backend\espeak\wrapper.py", line 92, in setstate
self.init()
File "E:\vits2\vits2\lib\site-packages\phonemizer\backend\espeak\wrapper.py", line 60, in init
self._espeak = EspeakAPI(self.library())
File "E:\vits2\vits2\lib\site-packages\phonemizer\backend\espeak\wrapper.py", line 141, in library
raise RuntimeError( # pragma: nocover
RuntimeError: PHONEMIZER_ESPEAK_LIBRARY="C:\Program Files\eSpeak NG\libespeak-ng.dll" is not a readable file
It's there. It's the 64 bit version. I don't know what it wants.
I edited wrapper.py to see what would happen and it printed out the actual error;
RuntimeError: failed to load espeak library: Could not find module 'E:\vits2\datasets\ljs_base\prepare"C:\Program Files\eSpeak NG\libespeak-ng.dll"' (or one of its dependencies). Try using the full path with constructor syntax.
Why the heck it is trying to prepend the current directory of the running script?
I have the same problem in a VM with Linux Ubuntu 22.04.4 LTS (x86-64)
Even though the model worked fine on a local machine with windows, when passing the path to the espeak-ng library according to this installation guide https://bootphon.github.io/phonemizer/install.html , I could not make it work in a VM under Ubuntu 22.04.4 LTS x86-64. When running my script to transcribe phonemes via wav2vec2phoneme, I got the following message
Traceback (most recent call last):
File "/dialrec/phoneme_transcription/phoneme_recognizers/transcribe.py", line 50, in
phoneme_recognizer = Wav2Vec2Phoneme()
File "/dialrec/phoneme_transcription/phoneme_recognizers/wav2vec2phoneme.py", line 24, in init
self.processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-xlsr-53-espeak-cv-ft")
File "/usr/local/lib/python3.10/site-packages/transformers/models/wav2vec2/processing_wav2vec2.py", line 52, in from_pretrained
return super().from_pretrained(pretrained_model_name_or_path, **kwargs)
File "/usr/local/lib/python3.10/site-packages/transformers/processing_utils.py", line 465, in from_pretrained
args = cls._get_arguments_from_pretrained(pretrained_model_name_or_path, **kwargs)
File "/usr/local/lib/python3.10/site-packages/transformers/processing_utils.py", line 511, in _get_arguments_from_pretrained
args.append(attribute_class.from_pretrained(pretrained_model_name_or_path, **kwargs))
File "/usr/local/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py", line 837, in from_pretrained
return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
File "/usr/local/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 2086, in from_pretrained
return cls._from_pretrained(
File "/usr/local/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 2325, in _from_pretrained
tokenizer = cls(*init_inputs, **init_kwargs)
File "/usr/local/lib/python3.10/site-packages/transformers/models/wav2vec2_phoneme/tokenization_wav2vec2_phoneme.py", line 153, in init
self.init_backend(self.phonemizer_lang)
File "/usr/local/lib/python3.10/site-packages/transformers/models/wav2vec2_phoneme/tokenization_wav2vec2_phoneme.py", line 202, in init_backend
self.backend = BACKENDS[self.phonemizer_backend](phonemizer_lang, language_switch="remove-flags")
File "/usr/local/lib/python3.10/site-packages/phonemizer/backend/espeak/espeak.py", line 45, in init
super().init(
File "/usr/local/lib/python3.10/site-packages/phonemizer/backend/espeak/base.py", line 39, in init
super().init(
File "/usr/local/lib/python3.10/site-packages/phonemizer/backend/base.py", line 77, in init
raise RuntimeError( # pragma: nocover
RuntimeError: espeak not installed on your system
For installing espeak, I followed these steps:
- apt-get install espeak-ng
- pip3 install phonemizer
- pip3 install espeakng (also tried pip3 install py-espeak-ng)
Espeak is definitely installed under /usr/lib/x86_64-linux-gnu/libespeak-ng.so.1 and /usr/bin/espeak-ng.
I tried the following:
- without additional steps
- Setting the environmental variable PHONEMIZER_ESPEAK_LIBRARY='/usr/lib/x86_64-linux-gnu/libespeak-ng.so.1' and PHONEMIZER_ESPEAK_PATH='/usr/bin/espeak-ng'.
- Setting the environmental variable directly in the script with
os.environ['PHONEMIZER_ESPEAK_LIBRARY'] = '/usr/lib/x86_64-linux-gnu/libespeak-ng.so.1'
os.environ['PHONEMIZER_ESPEAK_PATH'] = '/usr/bin/espeak-ng'
I would appreciate any help. Thanks in advance.
Hi, did you tried that (from docs):
conda env config vars set PHONEMIZER_ESPEAK_LIBRARY="/somewhere/to/libespeak-ng.so"?
I had the same issue on my M1 pro macbook, this environment worked. I changed it to somewhere like
export PHONEMIZER_ESPEAK_LIBRARY=/opt/homebrew/opt/espeak-ng/lib/libespeak-ng.dylib