Installing espeak using pip in Python 3.6

20k Views Asked by At

When I run pip install espeak, I get Could not find a version that satisfies the requirement espeak (from versions: ) . Anyone know how to fix this issue?

3

There are 3 best solutions below

1
On

As suggested in a comment, espeak is not a Python package available on PyPI.

Perhaps you meant one of these:

pip install pyespeak
pip install speake  # Python 2
pip install speake3  # Python 3

If none of these packages are the one you need, you can take a look at the list here: https://pypi.org/search/?q=espeak

0
On

Assuming you are after python-espeak, and are running Debian/Ubuntu, you likely want sudo apt-get install python-espeak. However, it is quite old and doesn't seem to support python3.

I'd recommend simply executing espeak directly using the subprocess module, like so:

#!/usr/bin/env python3
import subprocess

def espeak(text: str, pitch: int=50) -> int:
    """ Use espeak to convert text to speech. """
    return subprocess.run(['espeak', f'-p {pitch}', text]).returncode
0
On

I had the same problem in the context of using coqui-ai. For me what worked was to install espeak like this: brew install espeak. This discussion helped: https://github.com/coqui-ai/TTS/discussions/1973 .