Installing Technical Analysis Library for Python

I’m tinkering with some financial analysis scripts so when I got to looking into some useful python packages, Technical Anaysis Library popped up.  The python bindings require the TA Lib (Technical Analysis Library) which on osx is available via homebrew.  Now, when I originally installed I didn’t want to install it globally so I’ve got the less preferred, local install setup.  This local install results in the following necessary commands to get the pip package to install correctly.

# Activate homebrew
export PATH=~/homebrew/bin/:$PATH
# install TA-lib
brew install TA-lib
# set C_INCLUDE_PATH
export C_INCLUDE_PATH=~/homebrew/include/:$C_INCLUDE_PATH
# set LIBRARY_PATH
export LIBRARY_PATH=~/homebrew/lib/:$LIBRARY_PATH

Now that I’ve brew installed TA Lib and set the new include and library path, I can install the python bindings via pip.

# make virtualenv using virtualenv wrapper.
mkvirtualenv financial
pip install numpy
pip install TA-Lib

 

2 Comments

  1. Adam

    Hi Chad. I’m trying to install TA-Lib at the moment and battling. I have installed my pip version and tried to install it your way. unfortunately when I get to brew install, it notifies me that it is already installed. How can I remove any installations of TA-Lib from my mac.
    I have installed it previously but keep getting an error when importing it into my python IDE. It keeps saying that it can’t find the module. Please could you help me with this?
    I am using anaconda’s spyder and python 3.6 on a MacBook.

Leave a Reply