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

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.

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.

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!

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:
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:
Now, run enter your new conda environment with
and run
You should get 1.13.1 as a result.
If you got this far, you should be ready to install ctcdecode. To do that, simply run
And it should install without problems.
You can verify that it was successfully installed with
If you got <ctcdecode.CTCBeamDecoder object at 0x7fdadc664f10> it means that ctc is successfully installed!