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 #44

Open
PasaOpasen opened this issue May 25, 2020 · 49 comments
Open

RuntimeError: espeak not installed on your system #44

PasaOpasen opened this issue May 25, 2020 · 49 comments

Comments

@PasaOpasen
Copy link

How to solve RuntimeError: espeak not installed on your system on Windows without using Linux in Windows?

@mmmaat
Copy link
Collaborator

mmmaat commented May 25, 2020

You need to install espeak, or better, espeak-ng : https://github.com/espeak-ng/espeak-ng/blob/master/docs/building.md#windows

@PasaOpasen
Copy link
Author

Yes, I did it and can open and use espeak application, but phonemizer raises that error still

@mmmaat
Copy link
Collaborator

mmmaat commented May 26, 2020

Ok, so I suppose espeak-ng is not in your PATH. But phonemizer provides an alternative way to specify the path to espeak: you can setup the environment variable PHONEMIZER_ESPEAK_PATH with the absolute path to espeak (see https://github.com/bootphon/phonemizer/blob/master/phonemizer/backend/espeak.py#L62).

@PasaOpasen
Copy link
Author

PasaOpasen commented May 26, 2020

The path to espeak is the path to folder with TTSApp.exe, sure?

After creating this path I have an error:

PHONEMIZER_ESPEAK_PATH=C:\Program Files (x86)\eSpeak is not an executable file

Which path should I use? To which file?

@mmmaat
Copy link
Collaborator

mmmaat commented May 26, 2020

I don't have Windows so I cannot really help you with hands on... It has already been used on Windows and you are the first one to report such an issue. The PHONEMIZER_ESPEAK_PATH must be an absolute path to the .exe file, along with the .exe extension.

Maybe PHONEMIZER_ESPEAK_PATH=C:\Program Files (x86)\eSpeak.exe will work? If you have such a file... The good file must be an executable one, usable from command line (not a GUI one).

You can also try this one: https://sourceforge.net/projects/espeak/files/espeak/espeak-1.48/setup_espeak-1.48.04.exe

@PasaOpasen
Copy link
Author

Very good! There was the file C:\Program Files (x86)\eSpeak\command_line\espeak.exe and I did assign it to PHONEMIZER_ESPEAK_PATH. Now it works!

@sujithvoona
Copy link

sujithvoona commented Nov 9, 2020

Hey @PasaOpasen, before setting the environment variable path as PHONEMIZER_ESPEAK_PATH = C:\Program Files (x86)\eSpeak\command_line\espeak.exe did you store espeak.py file at any specific place.

Did the error got cleared after placing this espeak.py at a certain place and you set the environment variable path or you had nothing to do with the espeak.py file and set the environment variable "PHONEMIZER_ESPEAK_PATH"

I created a new environment variable PHONEMIZER_ESPEAK_PATH and I gave the path same as you C:\Program Files (x86)\eSpeak\command_line\espeak.exe. I am still facing the error.

Please help.

@danthemango
Copy link

That's because you're trying to add the path to the .exe file, you need to add the directory instead to the PATH variable:
"C:\Program Files (x86)\eSpeak\command_line"

@mmmaat mmmaat changed the title RuntimeError: espeak not installed on your system [Windows] RuntimeError: espeak not installed on your system May 10, 2021
@richardfoltin
Copy link

The variable name is changed to PHONEMIZER_ESPEAK_LIBRARY and it refers to the .dll now:
PHONEMIZER_ESPEAK_LIBRARY="c:\Program Files\eSpeak NG\libespeak-ng.dll"

@cantabile-kwok
Copy link

The variable name is changed to PHONEMIZER_ESPEAK_LIBRARY and it refers to the .dll now: PHONEMIZER_ESPEAK_LIBRARY="c:\Program Files\eSpeak NG\libespeak-ng.dll"

This worked very well and saved me a headache, thanks!

@wukongsleeping
Copy link

注意是PHONEMIZER_ESPEAK_LIBRARY和PHONEMIZER_ESPEAK_PATH
1.PHONEMIZER_ESPEAK_LIBRARY="c:\Program Files\eSpeak NG\libespeak-ng.dll"
2.PHONEMIZER_ESPEAK_PATH =“c:\Program Files\eSpeak NG”

@TheKOG
Copy link

TheKOG commented Aug 13, 2022

注意是PHONEMIZER_ESPEAK_LIBRARY和PHONEMIZER_ESPEAK_PATH 1.PHONEMIZER_ESPEAK_LIBRARY="c:\Program Files\eSpeak NG\libespeak-ng.dll" 2.PHONEMIZER_ESPEAK_PATH =“c:\Program Files\eSpeak NG”

finally it works!

@avst65t
Copy link

avst65t commented Oct 10, 2022

1.PHONEMIZER_ESPEAK_LIBRARY = C:\Program Files\eSpeak NG\libespeak-ng.dll
2.PHONEMIZER_ESPEAK_PATH = C:\Program Files\eSpeak NG

click new and add these variables to your system variables in environment variables
it will work

@djpelu
Copy link

djpelu commented Oct 24, 2022

i did this but it's still not working T_T is there maybe some detail that i'm missing? Do I need to install espeak in python or something. i'm going crazy

@mmmaat
Copy link
Collaborator

mmmaat commented Oct 24, 2022

Hi, I'm not a Windows expert so I can't really help you... But. Are you sure the "C:\Program Files\eSpeak NG\libespeak-ng.dll" you provided actually is an existing file?

Another solution: Use the docker image: https://bootphon.github.io/phonemizer/install.html#docker-image. Install docker on your machine, then install the docker image of the phonemizer.

Another solution: Use Windows subsystem for Linux (https://learn.microsoft.com/en-us/windows/wsl/install)

@djpelu
Copy link

djpelu commented Oct 24, 2022

thanks for the fast answer, the file actually exists, but it is in Program Files (x86) so i changed the path. However it doesn't come up when i look for it as a directory, could this be the problem? thanks, i'm really not an expert

@mmmaat
Copy link
Collaborator

mmmaat commented Oct 24, 2022

Ok... so it MUST BE the exact and absolute path to the libespeak-ng.dll file you installed with eSpeakNG. For instance C:\Program Files (x86)\eSpeak NG\libespeak-ng.dll or whatever it is on your computer. Add that path to the PHONEMIZER_ESPEAK_LIBRARY environment variable (I don't know how to do it on Windows) and it should work.

@djpelu
Copy link

djpelu commented Oct 24, 2022

i checked many times and the path is correct, however it's still not working. thank you again for your help, hope i can find a solution and post it here for anyone that may need it

@djpelu
Copy link

djpelu commented Oct 24, 2022

tt

this is what i've done. If someone knows why this doesn't work on windows, let me know. Thank you!

@QuLiao1117
Copy link

Did you solve that problem now? I meet the same problem with you.

@hildazzz
Copy link

hildazzz commented Nov 9, 2022

Me too! Please let me know if this problem solved. Thanks!

@djpelu
Copy link

djpelu commented Nov 10, 2022

Unfortunately I couln’t find a solution and i had to resort to another package

@LingXuanYin
Copy link

LingXuanYin commented Nov 13, 2022

Hey ,I've solved this !

(0) you need to comment out line75-80 in venv\Lib\site-packages\phonemizer\backend\espeak\base.py like this:

        if not self.is_available():
            pass
            #raise RuntimeError(  # pragma: nocover
                #'{} not installed on your system'.format(self.name()))

(1) Install espeak
with cmd command
winget install espeak
or download exe and install :https://sourceforge.net/projects/espeak/files/espeak/espeak-1.48/setup_espeak-1.48.04.exe/download

(2) Install espeak-ng
https://github.com/espeak-ng/espeak-ng/releases

(3) Copy the espeak-ng's dll C:\Program Files\eSpeak NG\libespeak-ng.dll to C:\Program Files (x86)\eSpeak\command_line and rename it to espeak-ng.dll or espeak.dll

(4) Add C:\Program Files (x86)\eSpeak\command_line to environment variable Path

(5) Restart your vscode/cmd/Jupyter or anything you run VITS or something else

You can uninstall eSpeak NG after you've done this
@QuLiao1117 @djpelu @Skye-ZHAO

@ziyaad30
Copy link

ziyaad30 commented May 9, 2023

Better method

from phonemizer.backend.espeak.wrapper import EspeakWrapper
_ESPEAK_LIBRARY = 'C:\Program Files\eSpeak NG\libespeak-ng.dll'
EspeakWrapper.set_library(_ESPEAK_LIBRARY)

@Artrajz
Copy link

Artrajz commented May 15, 2023

Better method

from phonemizer.backend.espeak.wrapper import EspeakWrapper
_ESPEAK_LIBRARY = 'C:\Program Files\eSpeak NG\libespeak-ng.dll'
EspeakWrapper.set_library(_ESPEAK_LIBRARY)

It indeed works!

@nehc0
Copy link

nehc0 commented Jun 15, 2023

Better method

from phonemizer.backend.espeak.wrapper import EspeakWrapper
_ESPEAK_LIBRARY = 'C:\Program Files\eSpeak NG\libespeak-ng.dll'
EspeakWrapper.set_library(_ESPEAK_LIBRARY)

Thank you very much!

@RomanVD39
Copy link

Nothing works.
The same issue on fresh win 10 and pip installation.
"RuntimeError: espeak not installed on your system"

@RomanVD39
Copy link

from phonemizer.backend.espeak.wrapper import EspeakWrapper
print(EspeakWrapper.library())
->C:\Program Files (x86)\eSpeak NG\libespeak-ng.dll

But when use phonemize():
... ... ...
File "D:\PyProjects\LV\venv\Lib\site-packages\phonemizer\backend\base.py", line 77, in init
raise RuntimeError( # pragma: nocover
RuntimeError: espeak not installed on your system

Any help?

@RomanVD39
Copy link

RomanVD39 commented Jul 19, 2023

I have uninstalled
espeak-ng-X86.msi
then installed
espeak-ng-X64.msi

So, C:\Program Files (x86)\eSpeak NG\libespeak-ng.dll was changed to C:\Program Files\eSpeak NG\libespeak-ng.dll

And this

from phonemizer.backend.espeak.wrapper import EspeakWrapper
_ESPEAK_LIBRARY = 'C:\Program Files\eSpeak NG\libespeak-ng.dll'
EspeakWrapper.set_library(_ESPEAK_LIBRARY)

works fine!

Be careful for right msi version!

@Kkordik
Copy link

Kkordik commented Sep 20, 2023

Guys, nothing worked for me from here, so I asked bing chat.

bing answer:
“Reboot the system: Sometimes changes in environment variables do not take effect until the system is rebooted.”

Finally worked. I've wasted 2 hours on this.

@BarathwajAnandan
Copy link

for linux or WSL users, Instead of doing pip install espeak, try 'sudo apt-get install espeak-ng'
worked for me.

@audiocommander
Copy link

fyi, I'm not on Windows, but on Mac OS Sonoma (ARM64, M2) and I have exactly the same troubles, hours sinking into this install. I have installed espeak via brew, it's available on zsh, I can open it and synthesise speech. I tried installed espeak-ng via pip (failed), via brew (kinda worked), via ports (worked) and made sure that I exported all paths correctly as seen here and otherwhere.

So, on shell, I have espeak, on python shell I can access espeakng, seems all good. But Juypter still tells me I haven't installed espeak. So I guess, this is rather an issue of how this library accesses espeak. I admit, I don't understand, why we need to handle full paths to dynamic libs when the full program command is available on my shell and thus also in python; isn't this the point of having conda and pip and such?

Trying a reboot now as a last step before giving up...

@jncasey
Copy link
Contributor

jncasey commented Nov 6, 2023

It's been a while since I installed it on my M1 Mac, but I'm pretty sure I had to compile espeak-ng from source to get it working

@cmp-nct
Copy link

cmp-nct commented Nov 19, 2023

Took me 2 hours to get espeak working with phonemizer.
That issue should not have been closed without implementing the needed changes so people do not have to waste so much time.
That should be bold information in the readme on the frontpage

@sunnnnnnnny
Copy link

@audiocommander For macos, if use brew install espeak; it only need change some code of ctypes package that find find_library function; Especially, edit miniconda3/envs/env/lib/pythonx/ctypes/util.py file with find_library function‘s possible variable(actually espeak lib path is /opt/homebrew/lib), it works for me;

@mmmaat
Copy link
Collaborator

mmmaat commented Nov 24, 2023

@sunnnnnnnny this is usually a bad idea to edit files from the standard library... Instead you may want to set the environment variable PHONEMIER_ESPEAK_LIBRARY=/opt/homebrew/lib/espeak.dylib (or the actual path to the espeak library on your machine). Or you can use/adapt this Python snippet:

from phonemizer.backend.espeak.wrapper import EspeakWrapper
_ESPEAK_LIBRARY = 'C:\Program Files\eSpeak NG\libespeak-ng.dll'
EspeakWrapper.set_library(_ESPEAK_LIBRARY)

mmmaat added a commit that referenced this issue Nov 24, 2023
@sunnnnnnnny
Copy link

@sunnnnnnnny this is usually a bad idea to edit files from the standard library... Instead you may want to set the environment variable PHONEMIER_ESPEAK_LIBRARY=/opt/homebrew/lib/espeak.dylib (or the actual path to the espeak library on your machine). Or you can use/adapt this Python snippet:

from phonemizer.backend.espeak.wrapper import EspeakWrapper
_ESPEAK_LIBRARY = 'C:\Program Files\eSpeak NG\libespeak-ng.dll'
EspeakWrapper.set_library(_ESPEAK_LIBRARY)

ok,thanks; i see it;

@mmmaat
Copy link
Collaborator

mmmaat commented Nov 24, 2023

Ok... This issue seems to cause a lot of troubles since a long time... I just updated the Windows installation instructions (https://bootphon.github.io/phonemizer/install.html#on-windows). Hope this helps.

I do not use - and don't know much about - Windows or MacOS so it's difficult for me to help or replicate problems from this thread.

Anyway I welcome any PR with improvement on the documentation from Windows/macOs users 🥇, thank you!

@mmmaat mmmaat reopened this Nov 24, 2023
@cmp-nct
Copy link

cmp-nct commented Nov 24, 2023

Ok... This issue seems to cause a lot of troubles since a long time... I just updated the Windows installation instructions (https://bootphon.github.io/phonemizer/install.html#on-windows). Hope this helps.

I do not use - and don't know much about - Windows or MacOS so it's difficult for me to help or replicate problems from this thread.

Anyway I welcome any PR with improvement on the documentation from Windows/macOs users 🥇, thank you!

Add this hint to the Windows instructions:
conda env config vars set PHONEMIZER_ESPEAK_PATH=“C:\Program Files\eSpeak NG”
conda env config vars set PHONEMIZER_ESPEAK_LIBRARY="C:\Program Files\eSpeak NG\libespeak-ng.dll"

I've tried a ton of things, including renaming the library (removing lib from libespeak-ng.dll removed 50% of the errors but then it got stuck again) or copying it into system32, nothing worked to get through the "layers of detection", those two environment variables did it.

@teddybear082
Copy link

In Anaconda environment, install espeak-ng then conda env config vars set PHONEMIZER_ESPEAK_PATH=“C:\Program Files\eSpeak NG” conda env config vars set PHONEMIZER_ESPEAK_LIBRARY="C:\Program Files\eSpeak NG\libespeak-ng.dll" It just worked.

THANK YOU SO MUCH. I spent over an hour this morning trying to get espeak phonemizer, which is a depency of styletts2, working on my system with anaconda, and your solution finally solved it

@iackov
Copy link

iackov commented Mar 5, 2024

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)

@matmult
Copy link

matmult commented Mar 10, 2024

@sunnnnnnnny this is usually a bad idea to edit files from the standard library... Instead you may want to set the environment variable PHONEMIER_ESPEAK_LIBRARY=/opt/homebrew/lib/espeak.dylib (or the actual path to the espeak library on your machine). Or you can use/adapt this Python snippet:

from phonemizer.backend.espeak.wrapper import EspeakWrapper
_ESPEAK_LIBRARY = 'C:\Program Files\eSpeak NG\libespeak-ng.dll'
EspeakWrapper.set_library(_ESPEAK_LIBRARY)

This finally fixed it for me, but using export PHONEMIZER_ESPEAK_LIBRARYPATH="/opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.dylib" is still broken for me on zsh. Am I using the wrong env variable name?

@jthack
Copy link

jthack commented Oct 3, 2024

this is what works on my mac:
export PHONEMIZER_ESPEAK_LIBRARY=/opt/homebrew/lib/libespeak-ng.dylib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests