Installation

Requirements

  • Python 3.6.1+

  • gcc 4.9+ for PyTorch1.0.0+

Optionally, GPU environment requires the following libraries:

  • Cuda 8.0, 9.0, 9.1, 10.0 depending on each DNN library

  • Cudnn 6+, 7+

  • NCCL 2.0+ (for the use of multi-GPUs)

(If you’ll use anaconda environment at installation step2, the following packages are installed using Anaconda, so you can skip them.)

  • cmake3 for some extensions

    # For Ubuntu
    $ sudo apt-get install cmake
    
  • sox

    # For Ubuntu
    $ sudo apt-get install sox
    # For CentOS
    $ sudo yum install sox
    
  • sndfile

    # For Ubuntu
    $ sudo apt-get install libsndfile1-dev
    # For CentOS
    $ sudo yum install libsndfile
    
  • ffmpeg (This is not required when installataion, but used in some recipes)

    # For Ubuntu
    $ sudo apt-get install ffmpeg
    # For CentOS
    $ sudo yum install ffmpeg
    
  • flac (This is not required when installataion, but used in some recipes)

    # For Ubuntu
    $ sudo apt-get install flac
    # For CentOS
    $ sudo yum install flac
    

Supported Linux distributions and other requirements

We support the following Linux distributions with CI. If you want to build your own Linux by yourself, please also check our CI configurations. to prepare the appropriate environments

  • ubuntu18

  • ubuntu16

  • centos7

  • debian9

Step 1) Install Kaldi

Related links:

Kaldi’s requirements:

  • OS: Ubuntu, CentOS, MacOSX, Windows, Cygwin, etc.

  • GCC >= 4.7

  1. Git clone Kaldi

    $ cd <any-place>
    $ git clone https://github.com/kaldi-asr/kaldi
    
  2. Install tools

    $ cd <kaldi-root>/tools
    $ make -j <NUM-CPU>
    
    1. Select BLAS library from ATLAS, OpenBLAS, or MKL

    • OpenBLAS

    $ cd <kaldi-root>/tools
    $ ./extras/install_openblas.sh
    
    • MKL (You need sudo privilege)

    $ cd <kaldi-root>/tools
    $ sudo ./extras/install_mkl.sh
    
    • ATLAS (You need sudo privilege)

    # Ubuntu
    $ sudo apt-get install libatlas-base-dev
    
  3. Compile Kaldi & install

    $ cd <kaldi-root>/src
    # [By default MKL is used] ESPnet uses only feature extractor, so you can disable CUDA
    $ ./configure --use-cuda=no
    # [With OpenBLAS]
    # $ ./configure --openblas-root=../tools/OpenBLAS/install --use-cuda=no
    # If you'll use CUDA
    # ./configure --cudatk-dir=/usr/local/cuda-10.0
    $ make -j clean depend; make -j <NUM-CPU>
    

We also have prebuilt Kaldi binaries.

Step 2) Installation ESPnet

  1. Git clone ESPnet

    $ cd <any-place>
    $ git clone https://github.com/espnet/espnet
    
  2. Put Kaldi at espnet/tools

    Create a symbolic link to Kaldi directory.

    $ cd <espnet-root>/tools
    $ ln -s <kaldi-root> .
    
  3. Setup CUDA environment

    Specify your CUDA directory.

    $ cd <espnet-root>/tools
    $ . ./setup_cuda_env.sh <cuda-root>  # e.g. <cuda-root> = /usr/local/cuda
    # If you have NCCL (If you'll install pytorch from anaconda, NCCL is also bundled, so you don't need to give it)
    # $ . ./setup_cuda_env.sh <cuda-root> <nccl-root> # e.g. <nccl-root> = /usr/local/nccl
    
  4. Setup Python environment

    The Python interpreter used in espnet recipes is determined by <espnet-root>/tools/activate_python.sh, and in this step, you need to create the file.

    You must select one of setup scripts for Python environment here. We prepare scripts for Anaconda, venv, and System Python environment, so if you’ll use the other Python environment manager, e.g. pipenv, pyenv, or etc. you need to create activate_python.sh by yourself.

    If you don’t stick to any Python environments, please select Anaconda environment.

    • Option A) Setup Anaconda environment

      $ cd <espnet-root>/tools
      $ ./setup_anaconda.sh [output-dir-name] [conda-env-name] [python-version]
      

      If [output-dir-name] is omitted, venv is generated. If [conda-env-name] and [python-version] are omitted, the root environment and the default Python of Anaconda are selected respectively.

      This script tries to create a new miniconda at venv if it doesn’t exist. If you already have Anaconda and you’ll use it then,

      $ cd <espnet-root>/tools
      $ CONDA_TOOLS_DIR=$(dirname ${CONDA_EXE})/..
      $ ./setup_anaconda.sh ${CONDA_TOOLS_DIR} [conda-env-name] [python-version]
      
    • Option B) Setup venv from system Python

      $ cd <espnet-root>/tools
      $ ./setup_venv.sh $(command -v python3)
      
    • Option C) Setup system Python environment

      $ cd <espnet-root>/tools
      $ ./setup_python.sh $(command -v python3)
      
  5. Install ESPnet

    $ cd <espnet-root>/tools
    $ make
    

    The Makefile tries to install ESPnet and all dependencies including PyTorch. You can also specify PyTorch version, for example:

    $ cd <espnet-root>/tools
    $ make TH_VERSION=1.3.1
    

    If you don’t have nvcc command, packages are installed for CPU mode by default. If you’ll turn it on manually, give CPU_ONLY option.

    $ cd <espnet-root>/tools
    $ make CPU_ONLY=0
    

Step 3) [Option] Manual installation

If you are stuck in some troubles when installation, you can also install them ignoring the Makefile.

Note that the Python interpreter used in ESPnet experiments is written in <espnet-root>/tools/activate_python.sh, so you need to activate it before installing python packages.

cd <espnet-root>/tools
. activate_python.sh
python3 -m pip install <some-package>
./installers/install_<some-tool>.sh

Check installation

You can check whether your installation is succesfully finished by

cd <espnet-root>/tools
. ./activate_python.sh; python3 check_install.py

Note that this check is always called in the last stage of the above installation.