How to install and use mozilla/TTS

My first experiment with machine learning. I show you how to get and setup Mozilla Text To Speech neural network. How to learn it, and how to use.

I try to setup mozilla/tts (TTS – text to speech) to my MacBook Pro 2017. And I need to say, learning TTS can take few days… And if you have same laptop as I, you need more powerfull computer.

So. At first I make new VirtualBox instance of Debian 9 or 10 and x64. I think no need to explain how to do it. All you need it’s standard utilities and ssh server to install while you install debian Go to next step 😉

Let’s clone from git.

We need to correct environment var PATH. Execute cat .profile > .bash_profile after that our ~./bash_profile must be same as lower block.

alias python='python3'
alias python2='python2'

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then

Let’s make some additional setup

cd # Just to go to our home directory
su # To install GIT
apt-get update
apt-get upgrade
apt-get install git # Say Y to all questions

apt-get install pkg-config # for matplotlib
apt-get install python3-pip # To use python3 package manager
apt-get install python-dev python3-dev
apt-get install build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev
apt-get install libsndfile1
apt-get install python3-cairo
apt-get install setuptools

exit # Return to our non-privileged user

pip3 install freetype-py
pip3 install pypng

cat requirements.txt 
pip3 install numpy==1.14.3
pip3 install 'torch>=0.4.1'
pip3 install librosa==0.5.1
pip3 install Unidecode==0.4.20
pip3 install tensorboard
pip3 install tensorboardX
pip3 install Pillow
pip3 install flask
pip3 install tqdm
pip3 install soundfile
pip3 install matplotlib==2.0.2 # 2.2.2 with no errors

chmod 755 ./
unlink ./
~/miniconda3/bin/conda install -c ilastik scipy

su -c 'chmod -R 755 ./TTS/'

cd ./TTS

su -c 'python3 ./ develop' # we have error but i'ts ok

pip3 install segments
pip3 install attrs

delete all rows from in dependency block except phonemizer

get models or learn

python3 ./ 

Now we need to setup default python version to 3 or higher. Read article in my blog > How to set Python’s default version

Next step is clone TTS from mozilla git repository.

git clone

Wait some time wile all files downloaded…

cd TTS # it's our main neural network directory
su root -c 'python3 ./ develop'

After we try to install by we have error.

* The following required packages can not be built:
* freetype, png

We need to install it by hands.

pip3 install freetype-py
pip3 install pypng

After we install all missed libraries try to setup another once

su -c 'apt-get install python3-matplotlib'

Version of matplotlib you can get from requirements.txt by command cat requirements.txt

Before we start install all things from requirements.txt or use like in we need to install some additional things not listed in instructions.

Now we have python3 by default and we can start setup out environment for TTS.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.