TaLib is a high quality technical analysis library, originally written in C language. Thanks to its developers, there is a Python wrapper which allows us to use in Python, too. However, installing it is a bit tricky and requires more steps than simply installing it with pip. In this post, I am going to show how to install TaLib Library on Linux. I’ve spent a couple hours to overcome all the error messages. Read this post and follow the steps so that you won’t waste your hours trying to install TaLib Library on Linux.
Step 1 – Install TaLib binaries
Before installing the Python wrapper (pip install), you need to install TA-Lib binaries. In order to do it, first download and unzip the binaries:
curl -L -O http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && tar -xvzf ta-lib-0.4.0-src.tar.gz
Then you need to compile:
cd ta-lib/ && ./configure --prefix=/usr
When I ran
checking build system type… posix/config.guess: unable to guess system type
The problem is that config.guess and config.sub files are outdated. You need to go to this address for config.guess and copy and replace the contents of your current config.guess file. Similarly, go to this page and copy its contents and replace your current config.sub file. Both files are under ta-lib directory.
After this, install the binaries:
make && sudo make install
After this you are ready to install Python wrapper.
Step 2 – Use pip to install Ta-Lib Python wrapper
Simply install using pip:
python3 -m pip install TA-Lib
This should be all. From now on, you can install Ta-Lib Python Library, import it and use more than 150 technical analysis indicators easily.