Close Navigation
Learn more about IBKR accounts
How to Install Ta-Lib in Python – Part III

How to Install Ta-Lib in Python – Part III

Posted July 8, 2021
Ishan Shah, Rekhit Pachanekar and Gaurav Singh
QuantInsti

Ishan Shah, Rekhit Pachanekar and Gaurav Singh demonstrate how to install Ta-Lib across platforms using Anaconda prompt in Part I, and showcase how to install it on Windows PC in Part II.

Install Ta-Lib on MacOS

In comparison to the windows installation, Python Ta-Lib installation is relatively straightforward and easy on the MacOS. But before we talk about the installation of Ta-Lib, we have to make sure the python environment is installed as well.

You can install Anaconda from here or download Python from here.

In our opinion, it is generally a good idea to install Anaconda as it helps build an environment for your python code to be executed seamlessly.

Note: During the Anaconda installation, you will be asked to install either Python 2.7 or 3.7. Since the support for Python 2.7 ended on January 1, 2020, it would be advisable to select the 3.7 version. For a seamless installation, choose the graphical installer.

mac_python_version

You will then be greeted with the following dialog box.

Dialog_box

Select “Continue” tab and choose the appropriate install destination and you will finish installation in a short time.

All right, now we move on to the main event, i.e. Python Ta-lib installation. Ok, there is one small step you need to do before the main install.

Check if you can use the ‘brew’ command. For this tutorial on how to install Ta-Lib, let us assume that the ‘brew’ command throws an error. To rectify this, we install the necessary package by using the following line of code in the MacOS shell:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

If it is successful, you will see the following messages:

homebrew_install

Of course, you will get a prompt which asks you to press “Return” to continue the installation or any other key to cancel the installation. If you are curious about the ‘brew’ command, you can always visit this website to know more.

Great! Now that the brew command is installed, use the following code to install the Ta-Lib operating system dependencies:

brew install ta-lib

You will see the following screen

Now, we use the familiar command i.e. “pip” to install Ta-Lib on our MacOS. The command is as follows:

pip install ta-lib

You see the following files being installed on your system.

Great! We have been successful in our quest to install Ta-Lib on MacOS.

But how do we check if it is correctly installed on the system? Simple, we use the following commands.

First, we call the python language by simply writing “python” in the terminal. We then use the following command to import the Ta-Lib library.

import talib

If there is no error, then we should be able to see the following screen

In the next installments, the authors will demonstrate how to install Ta-Lib on Install Ta-Lib on Linux.

Visit QuantInsti for additional insight on this topic:
https://blog.quantinsti.com/install-ta-lib-python/

Disclosure: Interactive Brokers

Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from QuantInsti and is being posted with its permission. The views expressed in this material are solely those of the author and/or QuantInsti and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

IBKR Campus Newsletters

This website uses cookies to collect usage information in order to offer a better browsing experience. By browsing this site or by clicking on the "ACCEPT COOKIES" button you accept our Cookie Policy.