Search code examples
pythonandroidta-libpydroid

TA-lib library not installing in pydroid 3?


I tried all ways given in the discription in of TA-Lib. But not able to install it in my Android 10 mobile in Pydroid app.

1} pip install TA-Lib

It gives error. Talib library cannot found


Solution

  • TA-Lib is a library written in C. You're trying to install a python wrapper for it. It won't work without the native library.

    I've prepared a C sources and instructions to build library on the phone. In a nutshell (tested with Nokia 6):

    1. Install PyDroid 3 from Google Play.
    2. Open it and install 2 packages via Pip (install repository plugin if needed): wget, cmake
    3. Open PyDroid's terminal:
    # let's make a working dir
    mkdir talib
    cd talib
    
    # download the buildable ta-lib sources
    wget https://github.com/trufanov-nok/ta-lib-rt/releases/download/0.6.0/libta-lib_0.6.0.PyDroid3.tar.gz
    
    # unpack them
    tar xf libta-lib_0.6.0.PyDroid3.tar.gz
    
    # make a build dir
    mkdir build
    cd build
    
    #build and install the library
    cmake -DCMAKE_INSTALL_PREFIX=/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/ ..
    make
    make install
    
    1. Install via Pip packages cython and ta-lib. Or better In terminal type in
    pip -v install cython
    pip -v install ta-lib
    

    I prefer the last variant of installation as it allows to track the process.
    Note: It may take up to 5 min to compile wrapper and produce a lot of warnings which is ok.

    1. Type in the test python code in PyDroid 3:
    import talib
    print(talib.__ta_version__)
    

    output should be

    b'0.6.0-dev (Nov 24 2020 20:15:43)`
    [Program finished]