ModuleNotFoundError: No module named 'talib'

Viewed 14760

Cannot install ta-lib on MacOS.

pip install ta-lib

How to install it?

3 Answers

Faced the issue on Big sur again

The situation: brew install ta-lib was successful and so was pip install TA-Lib version 0.4.19

On console:

   >>> import talib

   Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   ModuleNotFoundError: No module named 'talib'`

Solution: Installing from source worked for me, here are the steps

  • Install ta-lib using homebrew brew install ta-lib, this is required

  • Download the source from TALIB_SOURCE

  • untar/unzip the download ( tar -xvzf mrjbq7-ta-lib-TA_Lib-0.4.19-19-g5eb3fa4.tar.gz

  • cd into the folder and run:

pip install -r requirements.txt 
python setup.py install

import talib should be working now

Here is the solution that usually works for me. In the file you are trying to import the module copy and paste the following code and run it. Then you will be ready to go.

from pip._internal import main as install

install(["install","ta-lib"])

Hope this will work for you, Good luck.

Related