Installation

Dependencies

You need python>=3.6. If you really need to use python2, use the phonemizer-1.0 release.

You need to install festival, espeak-ng and/or mbrola in order to use the corresponding phonemizer backends. Follow instructions for your system below.

On Debian/Unbuntu

To install dependencies, simply run

sudo apt-get install festival espeak-ng mbrola

When using the espeak-mbrola backend, additional mbrola voices must be installed (see here. List the installable voices with

apt search mbrola

On CentOS/Fedora

To install dependencies, simply run

sudo yum install festival espeak-ng

When using the espeak-mbrola backend, the mbrola binary and additional mbrola voices must be installed (see here).

On MacOS

espeak is available on brew at version 1.48: brew install espeak. If you want a more recent version you have to compile it from sources. To install festival, mbrola and additional mbrola voices, use the script provided here.

On Windows

Install espeak-ng with the .msi Windows installer provided with espeak releases.

Warning

On Windows the installation of espeak can cause issues (see here).

Make sure you install the correct .msi file for your platform. It exists for two architectures: X64 and X86. Most today’s machines are X64 so, if you don’t know which one to choose, you should start trying with espeak-ng-X64.msi.

If phonemizer fails with a message RuntimeError: espeak not installed on your system, it means the libespeak-ng.dll library file is not found by phonemizer. You can specify it’s path from Python (before calling the phonemize function):

from phonemizer.backend.espeak.wrapper import EspeakWrapper

EspeakWrapper.set_library('C:\Program Files\eSpeak NG\libespeak-ng.dll')

An alternative is to define the environment variable PHONEMIZER_ESPEAK_LIBRARY to the absolute path to the DLL. For example if using conda have a:

conda env config vars set PHONEMIZER_ESPEAK_LIBRARY="C:\Program Files\eSpeak NG\libespeak-ng.dll"

festival must be compiled from sources (see here and here. mbrola is not available for Windows.

Phonemizer

  • The simplest way is using pip:

    pip install phonemizer
    
  • OR install it from sources with:

    git clone https://github.com/bootphon/phonemizer
    cd phonemizer
    pip install .
    

    If you experiment an error such as ImportError: No module named setuptools during installation, refer to issue #11.

Docker image

Alternatively you can run the phonemizer within docker, using the provided Dockerfile. To build the docker image, have a:

git clone https://github.com/bootphon/phonemizer
cd phonemizer
sudo docker build -t phonemizer .

Then run an interactive session with:

sudo docker run -it phonemizer /bin/bash

Testing

When installed from sources or whithin a Docker image, you can run the tests suite from the root phonemizer folder (once you installed pytest):

pip install pytest
pytest