-
Notifications
You must be signed in to change notification settings - Fork 95
Installing TA-lib (and general custom dependencies) #1979
Recently we had a user whose use-case with Deephaven involved using the TA-lib Python package. Although the Python wrapper can be installed through a simple pip install command, installing TA-lib itself is not that simple, requiring installing the TA-lib package on the machine itself independent of Python.
This discussion will show how to install TA-lib for use within Deephaven.
The TA-lib Python package requires TA-lib to be installed on the local machine. The Python package's README has a section on installing the required TA-lib dependency. The Deephaven Docker image runs on a Debian distribution, so we'll need to follow the Linux steps.
To do this in Deephaven, we can follow the how to install packages guide on installing dependencies via a shell script during build.
The following shell script will allow us to install the dependencies. Since we are running from a fresh Debian Docker image, we will need to also setup apt-get along with a few other dependencies for the installation.
apt-get upgrade -y
apt-get update -y
apt install build-essential wget -y
wget https://artiya4u.keybase.pub/TA-lib/ta-lib-0.4.0-src.tar.gz
tar -xvf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure --prefix=/usr
make
make install
apt-get install python3-dev -y
pip install ta-libOnce our Deephaven instance has launched, we can go to localhost:10000 and we will have a Deephaven instance that is useable with TA-lib. We can now run Python code like this:
import numpy import talib close = numpy.random.random(100) output = talib.SMA(close) print(output)
The ta-lib install example app contains a runnable example of installing TA-lib within Deephaven. This is just one example of how to install custom dependencies in Deephaven, and can be extended and applied to any custom dependency that you may want to use with Deephaven.