Build FastText Library from Github

Following are the requirements to build FastText successfully :

  • OS : Linux Distribution(like Ubuntu, CentOS, etc.) or MacOS
  • Compiler with C++11 support latest gcc or clang

Check if GCC is installed in your Linux Distribution

Run the command “gcc –version” to check if gcc is installed. If not, install gcc and proceed with the building of FastText.

$ gcc --version
root@arjun-VPCEH26EN:/home/arjun/workspace/fasttext/fastText# gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

Build FastText

Open a terminal and run the following commands :

Clone fastText.git project to your local machine using git command.

$ git clone
Git Clone fastText.git - FastText Tutorial -
Git Clone fastText.git

Open fastText and make the build.

$ cd fastText
$ make
Build FastText - FastText Tutorial -
Build FastText

Verify the build

To verify if the build is successful and working, run the following command.

$ ./fasttext

“./fasttext” should output the following usage description

root@arjun-VPCEH26EN:/home/arjun/workspace/fasttext/fastText# ./fasttext
usage: fasttext <command></command> 

The commands supported by fasttext are:

  supervised              train a supervised classifier
  quantize                quantize a model to reduce the memory usage
  test                    evaluate a supervised classifier
  predict                 predict most likely labels
  predict-prob            predict most likely labels with probabilities
  skipgram                train a skipgram model
  cbow                    train a cbow model
  print-word-vectors      print word vectors given a trained model
  print-sentence-vectors  print sentence vectors given a trained model
  nn                      query for nearest neighbors
  analogies               query for analogies


We have successfully built FastText.


In this FastText Tutorial, we have learnt to build fastText from github. In our next tutorial, we shall Train and Test Supervised Text Classifier.