pythonimportta-lib

Is it possible that Mac M1 users are not able to use Python wrapper for TA-Lib?


so I've been trying different methods to install TA-Lib, and found several different methods to install it, none of which have been easy, but even when TA-Lib is installed and appears on pip list, and even managed to install it on pipenv virtual environment, however if I actually want to go ahead and use it by typing

import talib

I get the following error:

ImportError: 2): Symbol not found: _TA_ACOS Referenced from: /Users/teo/.local/share/virtualenvs/trendingcoin-nriNAUCq/lib/python3.8/site-packages/talib/_ta_lib.cpython-38-darwin.so Expected in: flat namespace in /Users/teo/.local/share/virtualenvs/trendingcoin-nriNAUCq/lib/python3.8/site-packages/talib/_ta_lib.cpython-38-darwin.so

Now I would like you to know that I have tried many different methods to install it, they are detailed in this thread: Is it enough to install TA-Lib on Brew to use it? Pip throws me an error

As a wanna-be technical analyst, it would be sad if I can't use the infamous TA-Lib.


Solution

  • I was able to make it work following some of the steps in this github issue: https://github.com/mrjbq7/ta-lib/issues/381

    $ arch -x86_64 brew install python@3.9
    $ arch -x86_64 brew install ta-lib
    $ arch -x86_64 brew link ta-lib
    $ arch -x86_64 python3.9 -m pip install --no-cache-dir ta-lib
    

    You'll need x86/brew and rosetta: https://stackoverflow.com/a/64997047/3090309

    NOTE: In my case, I went though so many intents, that really made the difference to include the --no-cache-dir option.