Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python TA-lib install error, how solve it?

i install TA-lib with below command,

pip install TA-lib

but got this error "command 'gcc' failed with exit status 1":

checked the Troubleshooting, installed the gcc, python-devel, libffi-devel, openssl-devel, but still not working!

then use conda install -c quantopian ta-lib=0.4.9 install talib but show error "The following specifications were found to be in conflict:- py-xgboost, - ta-lib 0.4.9*" then conda info ta-lib, it return the"NoPackagesFoundError: Package missing in current linux-64 channels"

like image 691
Fosen Avatar asked Jun 26 '17 10:06

Fosen


People also ask

How do I install TA-Lib on Windows?

To install Ta-Lib, you will first install Anaconda and then open the Anaconda prompt. You would then write the code, “conda install -c conda-forge ta-lib”, and press the “Enter” key. After a few moments, the ta-lib package will be installed. That's all there is to it.

What is TA-Lib in Python?

This is a Python wrapper for TA-LIB based on Cython instead of SWIG. From the homepage: TA-Lib is widely used by trading software developers requiring to perform technical analysis of financial market data. Includes 150+ indicators such as ADX, MACD, RSI, Stochastic, Bollinger Bands, etc.


2 Answers

I ran into exactly the same problem and was able to resolve it and install TA-lib on Linux and my OSX laptop. I'll stick to linux instructions here specifically CentOS, but the trick for both was the same... you must have TA-lib binary libraries installed on the machine before the python wrapper will install with pip.

The reference I used: ttps://github.com/mrjbq7/ta-lib

If this command is failing:

pip install TA-lib

Complaining about ta_libc headers as such:

func.c:256:28: fatal error: ta-lib/ta_libc.h: No such file or directory
compilation terminated.

You'll need to install TA-lib binaries before installing the python wrapper. I downloaded it as follows:

wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz

Then uncompressed it, compiled it and installed:

tar -xvf ta-lib-0.4.0-src.tar.gz 
cd ta-lib
./configure --prefix=/usr
make
sudo make install
sudo ldconfig

If you don't have gcc and/or python3-dev on your machine, the above steps will give you hard time. Initially they were blowing up on me, so I satisfied the dependencies with:

sudo yum install gcc
sudo yum install python36-dev

Then re-run the steps from the beginning, this time with success. The above solution worked in my case.

I hope that helps, Good Luck!

BTW. My first ever answer here, I hope it helps someone, I've used StackOverflow to get passed many problems in the past, so I am hoping to reciprocate.

2018-08-30 UDPATE: I kept running into compiling issues specifically the error listed below would happen repeatedly. It turned out that I didn't have enough RAM (1GB) in the Virtual Machine. Solution ref:(https://github.com/mrjbq7/ta-lib/issues/133) so I upgraded RAM (2GB) and issue went away.

talib/_ta_lib.c:208671:15: warning: assignment from incompatible pointer type [enabled by default]

2021-03-06 UDPATE: OSX Catalina update! When compiling the TA-lib on OSX Catalina (10.15+) the above instructions did not work, I had to modify this:

tar -xvf ta-lib-0.4.0-src.tar.gz 
cd ta-lib 
./configure 
make
sudo make install 

After that, the pip install worked fine. –

like image 182
darekm101 Avatar answered Oct 12 '22 19:10

darekm101


I have solved the problem with conda environment.using

conda install -c quantopian ta-lib 
like image 22
EMKAY Avatar answered Oct 12 '22 18:10

EMKAY