Installation Guide

For now, xLearn can support both Linux, Mac OS X, and Windows. To install xLearn on Windows, please go to this page. This page gives instructions on how to build and install the xLearn using pip and how to build xLearn from source code on Linux and Mac OSX. No matter what way you choose, make sure that your OS has already installed GCC or Clang (with the support of C++ 11) and CMake.

Install GCC or Clang

If you have already installed your C++ compiler before, you can skip this step.

  • On Cygwin, run setup.exe and install gcc and binutils.

  • On Debian/Ubuntu Linux, type the command:

    sudo apt-get install gcc binutils

    to install GCC (or Clang) by using:

    sudo apt-get install clang
  • On FreeBSD, type the following command to install Clang:

    sudo pkg_add -r clang
  • On Mac OS X, install XCode gets you Clang.

Install CMake

If you have already installed CMake before, you can skip this step.

  • On Cygwin, run setup.exe and install cmake.

  • On Debian/Ubuntu Linux, type the command to install cmake:

    sudo apt-get install cmake
  • On FreeBSD, type the command:

    sudo pkg_add -r cmake

On Mac OS X, if you have homebrew, you can use the command:

brew install cmake

or if you have MacPorts, run:

sudo port install cmake

You won’t want to have both Homebrew and MacPorts installed.

Install xLearn from Source Code

Building xLearn from source code consists two steps:

First, you need to build the executable files (xlearn_train and xlearn_predict), as well as the shared library ( for Linux or libxlearn_api.dylib for Mac OSX) from the C++ code. After that, users need to install the xLearn Python Package.

Build from Source Code

Users need to clone the code from github:

git clone

cd xlearn
mkdir build
cd build
cmake ../

If the building is successful, users can find two executable files (xlearn_train and xlearn_predict) in the build path. Users can test the installation by using the following command:


Install Python Package

Then, you can install the Python package through

cd python-package
sudo ./

You can also test the Python package by using the following command:

cd ../

One-Button Building

We have already write a script to do all the cumbersome work for users, and users can just use the folloing commands:

git clone

cd xlearn
sudo ./

You may be asked to input your password during installation.

Install xLearn from pip

The easiest way to install xLearn Python package is to use pip. The following command will download the xLearn source code from pip and install Python package locally. You must make sure that you have already installed C++11 and CMake in your local machine:

sudo pip install xlearn

The installation process will take a while to complete. After that, you can type the following script in your python shell to check whether the xLearn has been installed successfully:

>>> import xlearn as xl
>>> xl.hello()

You will see the following message if the installation is successful:

        | |
   __  _| |     ___  __ _ _ __ _ __
   \ \/ / |    / _ \/ _` | '__| '_ \
    >  <| |___|  __/ (_| | |  | | | |
   /_/\_\_____/\___|\__,_|_|  |_| |_|

      xLearn   -- 0.44 Version --

Install R Package

The R package installation guide is coming soon.