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

RuntimeError: espeak not installed on your system #163

Open
rumbleFTW opened this issue Jan 2, 2024 · 17 comments
Open

RuntimeError: espeak not installed on your system #163

rumbleFTW opened this issue Jan 2, 2024 · 17 comments

Comments

@rumbleFTW
Copy link

rumbleFTW commented Jan 2, 2024

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

@sway4em
Copy link

sway4em commented Jan 4, 2024

I'm having the same issue

@rumbleFTW
Copy link
Author

@sway4em Could you please mention your Operating system? I think this problem can be solved in MacOS (#159) and Windows (#44).

@sway4em
Copy link

sway4em commented Jan 4, 2024

@rumbleFTW I'm on MacOS

@rumbleFTW
Copy link
Author

Please check #159 for the solution for MacOS.

@sbinnee
Copy link

sbinnee commented Jan 4, 2024

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.

@rumbleFTW
Copy link
Author

@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.

@mmmaat
Copy link
Collaborator

mmmaat commented Jan 8, 2024

Hi, did you tried that (from docs):

conda env config vars set PHONEMIZER_ESPEAK_LIBRARY="/somewhere/to/libespeak-ng.so"

?

@rumbleFTW
Copy link
Author

Just tried. Didn't work for me. Can someone else like @sbinnee test out if it solves the issue on their system?

@scutcsq
Copy link

scutcsq commented Jan 9, 2024

I met the same problem. My platform is Linux. Besides, I don't know where the 'libespeak-ng.so' is located

@Teravus
Copy link

Teravus commented Jan 15, 2024

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?

@Teravus
Copy link

Teravus commented Jan 15, 2024

image

This is the only thing that worked for me. Hacking the library.

@lauraBoll
Copy link

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:

  1. apt-get install espeak-ng
  2. pip3 install phonemizer
  3. 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.

@JeffChien
Copy link

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

@yywhsgnd
Copy link

yywhsgnd commented Oct 4, 2024

我在装有 Linux Ubuntu 22.04.4 LTS (x86-64) 的虚拟机中遇到了同样的问题

尽管该模型在装有 Windows 的本地计算机上运行良好,但按照此安装指南https://bootphon.github.io/phonemizer/install.html将路径传递给 espeak-ng 库时,我无法使其在 Ubuntu 22.04.4 LTS x86-64 下的 VM 中运行。当我运行脚本通过 wav2vec2phoneme 转录音素时,我收到以下消息

回溯(最近一次调用最后一次): 文件“/dialrec/phoneme_transcription/phoneme_recognizers/transcribe.py”,第 50 行,在 phoneme_recognizer = Wav2Vec2Phoneme() 文件“/dialrec/phoneme_transcription/phoneme_recognizers/wav2vec2phoneme.py”,第 24 行,在 init self.processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-xlsr-53-espeak-cv-ft") 文件“/usr/local/lib/python3.10/site-packages/transformers/models/wav2vec2/processing_wav2vec2.py”,第 52 行,在 from_pretrained return super().from_pretrained(pretrained_model_name_or_path, **kwargs) 文件“/usr/local/lib/python3.10/site-packages/transformers/processing_utils.py”,第 465 行,在 from_pretrained args = cls._get_arguments_from_pretrained(pretrained_model_name_or_path,**kwargs) 文件“/usr/local/lib/python3.10/site-packages/transformers/processing_utils.py”,第 511 行,在 _get_arguments_from_pretrained args.append(attribute_class.from_pretrained(pretrained_model_name_or_path,**kwargs)) 文件“/usr/local/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py”,第 837 行,在 from_pretrained 返回中tokenizer_class.from_pretrained(pretrained_model_name_or_path,*inputs,**kwargs) 文件“/usr/local/lib/python3.10/site-packages/transformers/tokenization_utils_base.py”,第 2086 行,在 from_pretrained 中 返回 cls._from_pretrained( 文件“/usr/local/lib/python3.10/site-packages/transformers/tokenization_utils_base.py”,第 2325 行,在 _from_pretrained 中 tokenizer = cls(*init_inputs,**init_kwargs) 文件“/usr/local/lib/python3.10/site-packages/transformers/models/wav2vec2_phoneme/tokenization_wav2vec2_phoneme.py”,第 153 行,在 init 中 self.init_backend(self.phonemizer_lang) 文件“/usr/local/lib/python3.10/site-packages/transformers/models/wav2vec2_phoneme/tokenization_wav2vec2_phoneme.py”,第 202 行,在 init_backend 中 self.backend = BACKENDS[self.phonemizer_backend](phonemizer_lang, language_switch="remove-flags") 文件“/usr/local/lib/python3.10/site-packages/phonemizer/backend/espeak/espeak.py”,第 45 行,在 init 中 super().init( 文件“/usr/local/lib/python3.10/site-packages/phonemizer/backend/espeak/base.py”,第 39 行,在 init 中 super().init( 文件“/usr/local/lib/python3.10/site-packages/phonemizer/backend/base.py”,第 77 行,在 init 中 引发 RuntimeError(# pragma: nocover RuntimeError: espeak 未安装在您的系统上

为了安装 espeak,我遵循以下步骤:

  1. apt-get 安装 espeak-ng
  2. pip3 安装 phonemizer
  3. pip3 install espeakng(也尝试过 pip3 install py-espeak-ng)

Espeak 肯定安装在 /usr/lib/x86_64-linux-gnu/libespeak-ng.so.1 和 /usr/bin/espeak-ng 下。

我尝试了以下操作:

  • 无需额外步骤
  • 设置环境变量PHONEMIZER_ESPEAK_LIBRARY='/usr/lib/x86_64-linux-gnu/libespeak-ng.so.1'和PHONEMIZER_ESPEAK_PATH='/usr/bin/espeak-ng'。
  • 使用os.environ['PHONEMIZER_ESPEAK_LIBRARY'] = '/usr/lib/x86_64-linux-gnu/libespeak-ng.so.1'
    os.environ['PHONEMIZER_ESPEAK_PATH'] = '/usr/bin/espeak-ng'直接在脚本中设置环境变量

我将非常感激您的帮助。提前致谢。

请问你解决了吗,我也遇到了相同的问题

@robbiemu
Copy link

robbiemu commented Oct 6, 2024

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

verified , works for me after installing with homebrew. I add the cell:

import os

# Set the environment variable within the notebook
os.environ['PHONEMIZER_ESPEAK_LIBRARY'] = '/opt/homebrew/opt/espeak-ng/lib/libespeak-ng.dylib'

and then it works

@RunChuanYe
Copy link

RunChuanYe commented Oct 17, 2024

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.

I encountered the same problem and successfully solved it with another method, at least it worked for me.

  1. I used

pacman -Ss espeak

to install arch4edu/espeak 1:1.48.04-4 in arch

  1. I encountered the above problem when using phonemizer
raise RuntimeError( # pragma: nocover
RuntimeError: espeak not installed on your system
  1. I reproduced the above
import ctypes
ctypes.cdll.LoadLibrary('libespeak-ng.so.1')

The results are similar, but the paths are different

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)

with taking

/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) 

as an example, we can copy /usr/lib/libstdc++.so.6 (this is the path on my server) to /home/seongbin/miniconda3/envs/tts/bin/../lib/.

Then this problem is solved, and it works for me.

@kiyoungkim1
Copy link

PHONEMIZER_ESPEAK_LIBRARY="c:\Program Files\eSpeak NG\libespeak-ng.dll"
PHONEMIZER_ESPEAK_PATH="c:\Program Files\eSpeak NG"

it works for me in Windows 11

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