Python TA-lib install error, how solve it?

后端 未结 4 1038
悲&欢浪女
悲&欢浪女 2021-02-10 14:31

i install TA-lib with below command,

pip install TA-lib

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

相关标签:
4条回答
  • 2021-02-10 14:52

    I have solved the problem with conda environment.using

    conda install -c quantopian ta-lib 
    
    0 讨论(0)
  • 2021-02-10 15:10

    This is how I fixed this issue in Linux: First I downloaded C dependency from: https://ta-lib.org/hdr_dw.html Installed it at a local directory using:

    ./configure --prefix=<local_path_to_install_c_library>
    make
    make install
    

    Then used pip to install ta-lib. Make sure to give --global-options to point pip to local library location.

    pip install --upgrade --global-option=build_ext --global-option="-L<local_path_to_install_c_library>/lib" --global-option="-I<local_path_to_install_c_library>/include" --install-option="--prefix=<local_path_to_install_python_lib>" ta-lib
    
    0 讨论(0)
  • 2021-02-10 15:11

    If below answer did not work for you(in my case it did not) you can find compiled whl file and install from there.

    Here's a link for compiled whl files for ta-lib.

    0 讨论(0)
  • 2021-02-10 15:15

    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]
    
    0 讨论(0)
提交回复
热议问题