Skip to content

A fool-proof guide to succesfully installing ctcdecode on Docker, Google Colab or your own PC #234

@RafaelAmauri

Description

@RafaelAmauri

This is a fool-proof guide to installing ctcdecode.

I have repeated these steps five times across four different servers running different versions of Linux. I have tested these steps on Ubuntu 20.04, Ubuntu 22.04 and Arch Linux.

The first thing you must have installed on your environment is gcc and g++. ctcdecode is NOT fully written in Python, it is instead a mix of Python and C, and uses gcc/g++ to compile the C code in a way that Python can understand. Because of this, make sure you have gcc, g++ and the libs for compiling code installed on your system.

For Ubuntu, run:

apt update -y
apt install gcc g++ build-essential

Selection_001

Now, install conda (pip unfortunately did not work for me no matter how much I tried using it. Conda worked every time I repeated the installation process) and then run:

conda create -n [your environment's name]
conda install -n [your environment's name] -y pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia
conda install -n [your environment's name] python=3.9

Now, run enter your new conda environment with

conda activate [your environment's name]

and run

python3 -c "import torch;print(torch.__version__)"

You should get 1.13.1 as a result.

Selection_002

If you got this far, you should be ready to install ctcdecode. To do that, simply run

cd ctcdecode; pip install .

And it should install without problems.

Selection_003

You can verify that it was successfully installed with

python3 -c "import ctcdecode;ctc = ctcdecode.CTCBeamDecoder(\"test\", beam_width=10, blank_id=\"test\");print(ctc)"

If you got <ctcdecode.CTCBeamDecoder object at 0x7fdadc664f10> it means that ctc is successfully installed!

Selection_004

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions