Using TA-Lib in a Jupyter notebook isn’t straightforward, and using it in a hosted solution like Deepnote could use a tutorial too. In this blog post, we’ll set up the popular Python wrapper for TA-lib.
A prerequisite for installing the TA-lib Python wrapper is that you have the TA-lib library installed. To do this in Deepnote, you need to take the following steps.
- Download TA-lib
- Upload it to Deepnote by dropping it in the file explorer of your notebook inside your browser
An interesting feature of Deepnote is that you can update the “initialization notebook”, which will be run every time you restart the kernel.
By adding some command lines, Deepnote will unzip and install TA-lib (both the library and the Python wrapper) with every cold start. There’s no point in only doing this once in the terminal: while the unzipped files will still be present inside the file explorer, they will no longer be installed on the machine.
Add the following lines to the initialization code block:
tar -xzf ta-lib-0.4.0-src.tar.gz
sudo make install
pip install TA-Lib
The initialization code block should now look like this: