How to install Tesseract from git source on CentOS 7 avoiding the error “configure: error: Leptonica 1.74 or higher is required.”

As you might know, from epel repository on CentOS 7 user is able to install tesseract 3.0.4 which also automatically installs leptonica 1.72. And if you want to install the higher or the latest version of tesseract you’ve to install both of them from source.

At first install some prerequisites:

yum install libpng-devel libtiff-devel libjpeg-devel automake ca-certificates g++ git libtool make pkg-config unzip 

// install git if not already installed
yum install git

Then install Leptonica at least 1.74 from

cd /any/directory
tar -xf leptonica-1.80.0.tar.gz
./configure --prefix=/usr/local/
make install

In case if you’ve already installed old version, you might see the error message like:

ln: failed to create symbolic link ‘libleptonica.a’: File exists
ln: failed to create symbolic link ‘’: File exists
ln: failed to create symbolic link ‘’: File exists

In this case remove the previous version of Leptonica (and if error still occurs, just delete the files)

yum remove leptonica

After, to make leptonica available you must configure the environment variables

vim /etc/profile

// ad this at the end of the file
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LIBLEPT_HEADERSDIR=/usr/local/include
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

// and update env
source /etc/profile

Now download and install Tesseract by following the official documentation:

./configure --prefix=/usr/local/
./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/include
make install

And finally, check the installed tesseract version by running the command:

tesseract --version

And you should get something like this:

tesseract 4.1.1
  libjpeg 9d : libpng 1.6.37 : libtiff 4.0.3 : zlib 1.2.7 : libwebp 1.1.0


Leave a Reply