5

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.

4

4 Answers 4

3

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 [email protected]
$ 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.

3

The solution here seems to work:

https://github.com/mrjbq7/ta-lib/issues/408#issuecomment-839583759

$ conda install -c conda-forge ta-lib

2

Install ta-lib

brew install ta-lib

Find pip command for your environment

which -a pip 
/home/<user>/.conda/envs/newenv/bin/pip <---------------
/usr/bin/pip 

Install ta-lib wrapper via pip command

/home/<user>/.conda/envs/newenv/bin/pip install ta-lib
0

Here's what I did with my Mac M1:

# install python3.10
arch -arm64 brew install ta-lib
export TA_INCLUDE_PATH="$(brew --prefix ta-lib)/include"
export TA_LIBRARY_PATH="$(brew --prefix ta-lib)/lib"
arch -arm64 python -m pip install --no-cache-dir ta-lib

Not the answer you're looking for? Browse other questions tagged or ask your own question.