bootphon / phonemizer

Simple text to phones converter for multiple languages
https://bootphon.github.io/phonemizer/
GNU General Public License v3.0
1.18k stars 165 forks source link

espeak installed but unable to found by phnemizer #117

Closed lucasjinreal closed 2 years ago

lucasjinreal commented 2 years ago
/phonemizer/backend/base.py", line 73, in __init__
    raise RuntimeError(  # pragma: nocover
RuntimeError: espeak not installed on your system
(base) jintn@jintndeMBP ~/d/c/a/b/t/v/nix-tts> brew install espeak
Warning: espeak 1.48.04_1 is already installed and up-to-date.
To reinstall 1.48.04_1, run:

Any idea?

mmmaat commented 2 years ago

Maybe espeak has been installed by brew into a non-standard location?

If you know where your espeak.dylib file has been installed, just do this before using phonemizer:

export PHONEMIZER_ESPEAK_LIBRARY=/path/to/espeak.dylib
phonemize "whatever params you need"

On Linux you can locate the path to that library with ldd $(which espeak) | grep espeak, the equivalent command on macos should be otool -L $(which espeak) | grep espeak (I'm not sure I don't have a mac).

lucasjinreal commented 2 years ago

on macOS, seems ctypes unable to find it. I installed using brew, and it was inside /opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.dylib, solved it already.

xihalameilin commented 1 year ago

how can you solve ? @jinfagang

amallecourt commented 1 year ago

Another reason that can provoque this error on Mac M1/M2, is the architecture incompatibility (arm64 vs x86_64). Here, the phenomizer libraire needs an espeak installation from the x86_64 architecture. So if you are on arm64, you should first install homebrew for x86_64, and then use this version to install espeak. And it'll work.

For the details:

newtondotcom commented 1 year ago

still doesn't work :( always the same error : espeak not installed on your system, even after following your steps

amallecourt commented 1 year ago

Sorry, there was a typo mistake in my answer, try again please

lukasschmit commented 1 year ago

Hi, I'm having this issue on a new M2 mbp. I tried running your commands @amallecourt but still get the same "espeak not installed" error. Do you have to run python with some architecture flag?

amallecourt commented 1 year ago

No, I don't think so. Try to look in phenomizer.backend.espeak.wrapper.py if you satisfy all conditions

lukasschmit commented 1 year ago

figured it out—for my brew installation on my m2 the path is PHONEMIZER_ESPEAK_LIBRARY=/opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.dylib for anyone else who stumbles into this haha

TythonLee commented 12 months ago

In my ubuntu environment, set the path works: export PHONEMIZER_ESPEAK_LIBRARY=/usr/bin/espeak-ng

SkyViz commented 8 months ago

figured it out—for my brew installation on my m2 the path is PHONEMIZER_ESPEAK_LIBRARY=/opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.dylib for anyone else who stumbles into this haha

I tried the same, but its not working for me. When I use terminal and check if I had set the variable correctly? it shows me correct results.

yajvikani@Skys-MacBook ~ % echo $PHONEMIZER_ESPEAK_LIBRARY
/opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.dylib

Also, within terminal when I try espeak hello, it works. but it does not work when I use it in a python code:

from phonemizer import phonemize phonemize("Hello", language='en-us', backend='espeak')

RuntimeError: espeak not installed on your system

TythonLee commented 8 months ago

你好,邮件已收到,谢谢~

vmirnv commented 8 months ago

I solved this problem on my M1 Mac for running code in Jupyter Notebook:

1. Install arm64 brew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)" 
brew install espeak

2. Run export before Jupyter:

export PHONEMIZER_ESPEAK_LIBRARY=/opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.dylib
jupyter notebook --no-browser

3. It should work now, but to be 100% sure, here's some additional code:

import os
import pathlib
print(pathlib.Path(os.environ['PHONEMIZER_ESPEAK_LIBRARY']).resolve())
# Output: PosixPath('/opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.1.1.48.dylib')

import ctypes
print(ctypes.cdll.LoadLibrary('/usr/local/Cellar/espeak/1.48.04_1/lib/libespeak.1.1.48.dylib'))
# Output: <CDLL '/opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.1.1.48.dylib', handle 89a128f0 at 0x10b42ccd0>
iackov commented 6 months ago

My Solution for Windows:
from phonemizer.backend.espeak.wrapper import EspeakWrapper EspeakWrapper.set_library('C:\Program Files\eSpeak NG\libespeak-ng.dll') eSpeak NG - Installed from official site (msi)

TythonLee commented 6 months ago

你好,邮件已收到,谢谢~

DrBrule commented 3 months ago

I solved this problem on my M1 Mac for running code in Jupyter Notebook:

Cheers for that! I just spent hours trying to get this working, this process was helpful. Ensuring that brew is installing the ARM64 version of espeak (and removing any conflicting versions from both /usr/local/bin and /opt/homebrew/... finally got it functioning for me. The ctypes sanity check pointed me in the proper direction.

It seems that homebrew defaults to the x86_64 version for some reason, and that conflicts with phonemizer.

However : print(ctypes.cdll.LoadLibrary('/usr/local/Cellar/espeak/1.48.04_1/lib/libespeak.1.1.48.dylib')) should be print(ctypes.cdll.LoadLibrary('/opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.1.1.48.dylib'))

TythonLee commented 3 months ago

你好,邮件已收到,谢谢~